Skip to content

Commit 8010d78

Browse files
Merge remote-tracking branch 'master' into BETA_JAVA26
- re-generate apttestprocessors8.jar after sources were merged
2 parents e5a0234 + 90dce92 commit 8010d78

File tree

92 files changed

+2109
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2109
-381
lines changed
364 Bytes
Binary file not shown.

org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/inherited/ArgsConstructorProcessor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ private boolean doesClassContainArgsConstructor(Element el,
161161
return false;
162162
}
163163

164+
@SuppressWarnings("deprecation")
164165
private final TypeVisitor<Boolean, List<TypeMirror>> argsVisitor = new SimpleTypeVisitor6<>() {
165166
@Override
166167
public Boolean visitExecutable(ExecutableType t,

org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/visitors/VisitorProc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class VisitorProc extends BaseProcessor
4949
* This visitor is invoked on the top-level types in resources/targets/model.
5050
* We expect to see each of the visitX() methods get hit as a result.
5151
*/
52+
@SuppressWarnings("deprecation")
5253
private static class ElementVisitorTester extends ElementScanner6<Void, Void> {
5354

5455
public enum Visited { TYPE, EXECUTABLE, VARIABLE, TYPEPARAM, PACKAGE, UNKNOWN }
@@ -131,6 +132,7 @@ public Void visitUnknown(Element e, Void p) {
131132
/*
132133
* The specific values checked by this visitor correspond to values in targets.model.pc.TypedAnnos.java
133134
*/
135+
@SuppressWarnings("deprecation")
134136
private static class AnnotationVisitorTester extends AbstractAnnotationValueVisitor6<Void, Void> {
135137

136138
public enum Visited { ANNOTATION, ARRAY, BOOLEAN, BYTE, CHAR, DOUBLE, ENUMCONSTANT, FLOAT, INT, LONG, SHORT, STRING, TYPE }

org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java8ElementProcessor.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,23 @@ public void testGH4617() {
10821082
}
10831083
assertEquals("Incorrect order received", "gamma,alpha,beta,", builder.toString());
10841084
}
1085+
public void testGH1752() {
1086+
TypeElement type = _elementUtils.getTypeElement("targets.GH1752.GH1752SubClass");
1087+
List<? extends Element> allMembers = _elementUtils.getAllMembers(type);
1088+
ExecutableElement m1 = null;
1089+
ExecutableElement m3 = null;
1090+
for (Element element : allMembers) {
1091+
if (element.getSimpleName().toString().equals("m1")) {
1092+
m1 = (ExecutableElement) element;
1093+
}
1094+
if (element.getSimpleName().toString().equals("m3")) {
1095+
m3 = (ExecutableElement) element;
1096+
break;
1097+
}
1098+
}
1099+
assertNotNull("Method m1 should not be null", m1);
1100+
assertNull("Method m3 should be null", m3);
1101+
}
10851102
private void createPackageBinary() throws IOException {
10861103
String path = packageName.replace('.', '/');
10871104
ClassLoader loader = getClass().getClassLoader();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package targets.GH1752;
2+
@Deprecated
3+
public class GH1752BaseClass {
4+
static void m1() {}
5+
private static void m3() {}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package targets.GH1752;
2+
@Deprecated
3+
public class GH1752SubClass extends GH1752BaseClass {
4+
void m2() {
5+
}
6+
}

org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java8ElementsTests.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,18 @@ public void testGH4617() throws Exception {
419419
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
420420
internalTestWithBinary(compiler, JAVA8_ANNOTATION_PROC, "testGH4617", null, "GH4617", "9");
421421
}
422+
public void testGH1752() throws Exception {
423+
if (!canRunJava9())
424+
return;
425+
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
426+
internalTestWithBinary(compiler, JAVA8_ANNOTATION_PROC, "testGH1752", null, "GH1752", "9");
427+
}
428+
public void testGH1752Javac() throws Exception {
429+
if (!canRunJava9())
430+
return;
431+
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
432+
internalTestWithBinary(compiler, JAVA8_ANNOTATION_PROC, "testGH1752", null, "GH1752", "9");
433+
}
422434
private void internalTest(JavaCompiler compiler, String processor, String testMethod) throws IOException {
423435
internalTest(compiler, processor, testMethod, null);
424436
}

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ protected void handleInternalException(
612612
needToPrint = false;
613613
}
614614
}
615-
if (needToPrint) {
615+
if (needToPrint || this.options.verbose) {
616616
/* dump a stack trace to the console */
617617
internalException.printStackTrace();
618618
}

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/AnnotationDiscoveryVisitor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public boolean visit(TypeParameter typeParameter, BlockScope scope) {
155155
// when we get here, it is guaranteed that class type parameters are connected, but method type parameters may not be.
156156
MethodBinding methodBinding = (MethodBinding) binding.declaringElement;
157157
((SourceTypeBinding) methodBinding.declaringClass).resolveTypesFor(methodBinding);
158-
this.resolveAnnotations(scope, annotations, binding);
158+
this.resolveAnnotations(scope, annotations, typeParameter.binding /* treat as volatile as Scope.preprocessTypeVariables() called by resolveTypesFor() may modify!!! */);
159159
}
160160
return false;
161161
}
@@ -248,10 +248,10 @@ private void resolveAnnotations(BlockScope scope, Annotation[] annotations, Bind
248248
if (length == 0)
249249
return;
250250

251-
boolean old = scope.insideTypeAnnotation;
252-
scope.insideTypeAnnotation = true;
251+
boolean old = scope.insideTypeDeclarationAnnotations;
252+
scope.insideTypeDeclarationAnnotations = true;
253253
currentBinding.getAnnotationTagBits();
254-
scope.insideTypeAnnotation = old;
254+
scope.insideTypeDeclarationAnnotations = old;
255255
ElementImpl element = (ElementImpl) this._factory.newElement(currentBinding);
256256
AnnotationBinding [] annotationBindings = element.getPackedAnnotationBindings(); // discovery is never in terms of repeating annotation.
257257
for (AnnotationBinding binding : annotationBindings) {

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/ElementsImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,10 @@ private void addMembers(ReferenceBinding binding, boolean directMembers, Map<Str
221221
}
222222
}
223223
for (MethodBinding method : binding.methods()) {
224-
if (!directMembers && method.isStatic())
225-
continue;
224+
if (!directMembers &&
225+
(method.isPrivate() || (binding.isInterface() && method.isStatic()))) {
226+
continue;
227+
}
226228
if (!method.isSynthetic() && (directMembers || (!method.isPrivate() && !method.isConstructor()))) {
227229
String methodName = new String(method.selector);
228230
Set<MethodBinding> sameNamedMethods = methods.get(methodName);

0 commit comments

Comments
 (0)