Skip to content

Commit

Permalink
Fix for #1325: recognize record component in compact constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Dec 29, 2021
1 parent 2896138 commit 95b86a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void testLog4j2() {
};
//@formatter:on

addRuntimeLibrary("org.apache.logging.log4j:log4j-api:2.17.0", "org.apache.logging.log4j:log4j-core:2.17.0");
addRuntimeLibrary("org.apache.logging.log4j:log4j-api:2.17.1", "org.apache.logging.log4j:log4j-core:2.17.1");
vmArguments = new String[] {"-Dorg.apache.logging.log4j.level=INFO", "-Dlog4j2.clock=T"};
runConformTest(sources, "[main] INFO C - yay!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@ public void testSealed3() {

private static boolean javaModelSealedSupport() {
return org.eclipse.jdt.core.JavaCore.getPlugin().getBundle().getVersion()
.compareTo(org.osgi.framework.Version.parseVersion("3.24")) >= 0;
.compareTo(org.osgi.framework.Version.parseVersion("3.28")) >= 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ protected TypeLookupResult findTypeForVariable(final VariableExpression var, fin
(isDirectAccess && resolveStrategy != Closure.OWNER_FIRST && resolveStrategy != Closure.OWNER_ONLY)) {
// accessed variable was found using direct search; forget the reference
accessedVar = new DynamicVariable(var.getName(), scope.isStatic());
} else if (accessedVar instanceof Parameter && ((Parameter) accessedVar).getEnd() < 1 && var.getEnd() > 0 && // explicit reference to implicit parameter
variableInfo != null && variableInfo.scopeNode instanceof ConstructorNode) {
// could be field reference from pre- or post-condition block (incl. record compact constructor)
accessedVar = ((MethodNode) variableInfo.scopeNode).getDeclaringClass().getField(var.getName());
}

if (accessedVar instanceof ASTNode) {
Expand Down

0 comments on commit 95b86a8

Please sign in to comment.