Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 125569 Details for
Bug 201912
[compiler] Unused public members of private classes not flagged
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch and testcases
patch.txt (text/plain), 28.32 KB, created by
Kent Johnson
on 2009-02-12 14:44:51 EST
(
hide
)
Description:
Proposed patch and testcases
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2009-02-12 14:44:51 EST
Size:
28.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java,v >retrieving revision 1.98 >diff -u -r1.98 ASTNode.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 5 Feb 2009 09:38:11 -0000 1.98 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 12 Feb 2009 19:39:06 -0000 >@@ -354,10 +354,8 @@ > > public final boolean isFieldUseDeprecated(FieldBinding field, Scope scope, boolean isStrictlyAssigned) { > // ignore references insing Javadoc comments >- if ((this.bits & ASTNode.InsideJavadoc) ==0 && >- !isStrictlyAssigned && >- (field.isPrivate() || (field.declaringClass != null && field.declaringClass.isLocalType())) && !scope.isDefinedInField(field)) { >- // ignore cases where field is used from within inside itself >+ if ((this.bits & ASTNode.InsideJavadoc) == 0 && !isStrictlyAssigned && field.isOrEnclosedByPrivateType() && !scope.isDefinedInField(field)) { >+ // ignore cases where field is used from inside itself > field.original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed; > } > >@@ -392,9 +390,8 @@ > public final boolean isMethodUseDeprecated(MethodBinding method, Scope scope, > boolean isExplicitUse) { > // ignore references insing Javadoc comments >- if ((this.bits & ASTNode.InsideJavadoc) ==0 && >- (method.isPrivate() || method.declaringClass.isLocalType()) && !scope.isDefinedInMethod(method)) { >- // ignore cases where method is used from within inside itself (e.g. direct recursions) >+ if ((this.bits & ASTNode.InsideJavadoc) == 0 && method.isOrEnclosedByPrivateType() && !scope.isDefinedInMethod(method)) { >+ // ignore cases where method is used from inside itself (e.g. direct recursions) > method.original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed; > } > >@@ -451,9 +448,8 @@ > > ReferenceBinding refType = (ReferenceBinding) type; > // ignore references insing Javadoc comments >- if ((this.bits & ASTNode.InsideJavadoc) == 0 && >- (refType.isPrivate() || refType.isLocalType()) && !scope.isDefinedInType(refType)) { >- // ignore cases where type is used from within inside itself >+ if ((this.bits & ASTNode.InsideJavadoc) == 0 && refType.isOrEnclosedByPrivateType() && !scope.isDefinedInType(refType)) { >+ // ignore cases where type is used from inside itself > ((ReferenceBinding)refType.erasure()).modifiers |= ExtraCompilerModifiers.AccLocallyUsed; > } > >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java,v >retrieving revision 1.93 >diff -u -r1.93 FieldDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 25 Sep 2008 23:10:29 -0000 1.93 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 12 Feb 2009 19:39:06 -0000 >@@ -51,11 +51,9 @@ > } > > public FlowInfo analyseCode(MethodScope initializationScope, FlowContext flowContext, FlowInfo flowInfo) { >- if (this.binding != null && !this.binding.isUsed()) { >- if (this.binding.isPrivate() || (this.binding.declaringClass != null && this.binding.declaringClass.isLocalType())) { >- if (!initializationScope.referenceCompilationUnit().compilationResult.hasSyntaxError) { >- initializationScope.problemReporter().unusedPrivateField(this); >- } >+ if (this.binding != null && !this.binding.isUsed() && this.binding.isOrEnclosedByPrivateType()) { >+ if (!initializationScope.referenceCompilationUnit().compilationResult.hasSyntaxError) { >+ initializationScope.problemReporter().unusedPrivateField(this); > } > } > // cannot define static non-constant field inside nested class >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java,v >retrieving revision 1.100 >diff -u -r1.100 ConstructorDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java 29 Jan 2009 17:00:08 -0000 1.100 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java 12 Feb 2009 19:39:06 -0000 >@@ -59,7 +59,7 @@ > if (constructorBinding.isPrivate()) { > if ((this.binding.declaringClass.tagBits & TagBits.HasNonPrivateConstructor) == 0) > break checkUnused; // tolerate as known pattern to block instantiation >- } else if ((this.binding.declaringClass.tagBits & (TagBits.IsAnonymousType|TagBits.IsLocalType)) != TagBits.IsLocalType) { >+ } else if (!constructorBinding.isOrEnclosedByPrivateType()) { > break checkUnused; > } > // complain unused >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java,v >retrieving revision 1.155 >diff -u -r1.155 TypeDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 3 Feb 2009 09:40:45 -0000 1.155 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 12 Feb 2009 19:39:06 -0000 >@@ -611,7 +611,7 @@ > * Common flow analysis for all types > */ > private void internalAnalyseCode(FlowContext flowContext, FlowInfo flowInfo) { >- if ((this.binding.isPrivate() || (this.binding.tagBits & (TagBits.IsAnonymousType|TagBits.IsLocalType)) == TagBits.IsLocalType) && !this.binding.isUsed()) { >+ if (!this.binding.isUsed() && this.binding.isOrEnclosedByPrivateType()) { > if (!this.scope.referenceCompilationUnit().compilationResult.hasSyntaxError) { > this.scope.problemReporter().unusedPrivateType(this); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java,v >retrieving revision 1.69 >diff -u -r1.69 MethodDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java 29 Jan 2009 17:00:08 -0000 1.69 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java 12 Feb 2009 19:39:06 -0000 >@@ -47,11 +47,13 @@ > if (this.binding == null) > return; > >- if (!this.binding.isUsed() && >- (this.binding.isPrivate() >- || (((this.binding.modifiers & (ExtraCompilerModifiers.AccOverriding|ExtraCompilerModifiers.AccImplementing)) == 0) && this.binding.declaringClass.isLocalType()))) { >- if (!classScope.referenceCompilationUnit().compilationResult.hasSyntaxError) { >- this.scope.problemReporter().unusedPrivateMethod(this); >+ if (!this.binding.isUsed()) { >+ if (this.binding.isPrivate() >+ || (((this.binding.modifiers & (ExtraCompilerModifiers.AccOverriding|ExtraCompilerModifiers.AccImplementing)) == 0) >+ && this.binding.isOrEnclosedByPrivateType())) { >+ if (!classScope.referenceCompilationUnit().compilationResult.hasSyntaxError) { >+ this.scope.problemReporter().unusedPrivateMethod(this); >+ } > } > } > >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java,v >retrieving revision 1.130 >diff -u -r1.130 ReferenceBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 11 Feb 2009 18:03:07 -0000 1.130 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 12 Feb 2009 19:39:07 -0000 >@@ -1077,6 +1077,20 @@ > } > > /** >+ * Answer true if the receiver or any of its enclosing types have private visibility >+ */ >+public final boolean isOrEnclosedByPrivateType() { >+ if (isLocalType()) return true; // catch all local types >+ ReferenceBinding type = this; >+ while (type != null) { >+ if ((type.modifiers & ClassFileConstants.AccPrivate) != 0) >+ return true; >+ type = type.enclosingType(); >+ } >+ return false; >+} >+ >+/** > * Answer true if the receiver has protected visibility > */ > public final boolean isProtected() { >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java,v >retrieving revision 1.113 >diff -u -r1.113 MethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 23 Jan 2009 19:50:22 -0000 1.113 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 12 Feb 2009 19:39:06 -0000 >@@ -748,6 +748,15 @@ > public final boolean isPrivate() { > return (this.modifiers & ClassFileConstants.AccPrivate) != 0; > } >+ >+/* Answer true if the receiver has private visibility or if any of its enclosing types do. >+*/ >+public final boolean isOrEnclosedByPrivateType() { >+ if ((this.modifiers & ClassFileConstants.AccPrivate) != 0) >+ return true; >+ return this.declaringClass != null && this.declaringClass.isOrEnclosedByPrivateType(); >+} >+ > /* Answer true if the receiver has protected visibility > */ > public final boolean isProtected() { >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java,v >retrieving revision 1.55 >diff -u -r1.55 FieldBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java 5 Dec 2008 12:41:30 -0000 1.55 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java 12 Feb 2009 19:39:06 -0000 >@@ -286,6 +286,14 @@ > public final boolean isPrivate() { > return (this.modifiers & ClassFileConstants.AccPrivate) != 0; > } >+/* Answer true if the receiver has private visibility or is enclosed by a class that does. >+*/ >+ >+public final boolean isOrEnclosedByPrivateType() { >+ if ((this.modifiers & ClassFileConstants.AccPrivate) != 0) >+ return true; >+ return this.declaringClass != null && this.declaringClass.isOrEnclosedByPrivateType(); >+} > /* Answer true if the receiver has private visibility and is used locally > */ > >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v >retrieving revision 1.168 >diff -u -r1.168 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 7 Jan 2009 17:31:51 -0000 1.168 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 12 Feb 2009 19:39:06 -0000 >@@ -40,6 +40,7 @@ > > void buildAnonymousTypeBinding(SourceTypeBinding enclosingType, ReferenceBinding supertype) { > LocalTypeBinding anonymousType = buildLocalType(enclosingType, supertype, enclosingType.fPackage); >+ anonymousType.modifiers |= ExtraCompilerModifiers.AccLocallyUsed; // tag all anonymous types as used locally > if (supertype.isInterface()) { > anonymousType.superclass = getJavaLangObject(); > anonymousType.superInterfaces = new ReferenceBinding[] { supertype }; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java,v >retrieving revision 1.100 >diff -u -r1.100 MethodVerifier.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java 4 Dec 2008 17:06:52 -0000 1.100 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java 12 Feb 2009 19:39:07 -0000 >@@ -205,6 +205,13 @@ > if (concreteMethod.thrownExceptions != Binding.NO_EXCEPTIONS) > for (int i = abstractMethods.length; --i >= 0;) > checkExceptions(concreteMethod, abstractMethods[i]); >+// if (concreteMethod.isOrEnclosedByPrivateType()) { //WHY do this check at all ? >+ // A subclass inheriting this method and putting it up as the implementation to meet its own >+ // obligations should qualify as a use. >+ concreteMethod.original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed; >+ for (int i = abstractMethods.length; --i >= 0;) >+ abstractMethods[i].original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed; >+// } > } > > /* >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java,v >retrieving revision 1.20 >diff -u -r1.20 ProblemConstructorTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java 27 Jun 2008 16:04:44 -0000 1.20 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java 12 Feb 2009 19:39:12 -0000 >@@ -138,4 +138,60 @@ > "Zork cannot be resolved to a type\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=201912, test to make sure that unused public members of >+// private class (including constructors, fields, types and methods) get warned about. >+public void test004() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " private class M { \n" + // expect unused field, method, constructor and type warnings >+ " private int state = 0;\n" + >+ " public int unusedMethod() { return this.state; }\n" + >+ " public M (int state) { this.state = state;} \n" + >+ " public int unusedField = 0;\n" + >+ " public class N {}\n" + >+ " }\n" + >+ " private class N { \n" + // No warnings should come from within here >+ " private int state = 0;\n" + >+ " public int usedMethod() { new O(); return new N(this.state + this.usedField).state; }\n" + >+ " public N (int state) { this.state = state;} \n" + >+ " public int usedField = 0;\n" + >+ " public class O {}\n" + >+ " }\n" + >+ " public class P { \n" + // No warnings should come from within here. >+ " private int state = 0;\n" + >+ " public int unusedMethod() { return this.state; }\n" + >+ " public P (int state) { this.state = state;} \n" + >+ " public int unusedField = 0;\n" + >+ " public class N {}\n" + >+ " }\n" + >+ " public M foo(M m, N n) {\n" + >+ " n.usedMethod(); return m;\n" + >+ " }\n" + >+ "} \n" >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 4)\n" + >+ " public int unusedMethod() { return this.state; }\n" + >+ " ^^^^^^^^^^^^^^\n" + >+ "The method unusedMethod() from the type X.M is never used locally\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 5)\n" + >+ " public M (int state) { this.state = state;} \n" + >+ " ^^^^^^^^^^^^^\n" + >+ "The constructor X.M(int) is never used locally\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 6)\n" + >+ " public int unusedField = 0;\n" + >+ " ^^^^^^^^^^^\n" + >+ "The field X.M.unusedField is never read locally\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 7)\n" + >+ " public class N {}\n" + >+ " ^\n" + >+ "The type X.M.N is never used locally\n" + >+ "----------\n" >+ ); >+} > } >Index: src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java,v >retrieving revision 1.47 >diff -u -r1.47 JavadocTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java 27 Jun 2008 16:04:44 -0000 1.47 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java 12 Feb 2009 19:39:12 -0000 >@@ -271,6 +271,54 @@ > " }\n" + > "}\n" }; > } >+ // The fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=201912 results in these additional >+ // diagnostics to be generated. Just as we arrange for the ``referencedClasses'' to be compiled >+ // automatically, we need to include these diagnostics automatically in the expected messages. >+ static String expectedDiagnosticsFromReferencedClasses = >+ "----------\n" + >+ "1. WARNING in test\\AbstractVisibility.java (at line 5)\n" + >+ " public int avf_public = avf_private;\n" + >+ " ^^^^^^^^^^\n" + >+ "The field AbstractVisibility.AvcPrivate.avf_public is never read locally\n" + >+ "----------\n" + >+ "2. WARNING in test\\AbstractVisibility.java (at line 10)\n" + >+ " public int avm_public() {\n" + >+ " ^^^^^^^^^^^^\n" + >+ "The method avm_public() from the type AbstractVisibility.AvcPrivate is never used locally\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. WARNING in test\\Visibility.java (at line 5)\n" + >+ " public int vf_public = vf_private;\n" + >+ " ^^^^^^^^^\n" + >+ "The field Visibility.VcPrivate.vf_public is never read locally\n" + >+ "----------\n" + >+ "2. WARNING in test\\Visibility.java (at line 11)\n" + >+ " public int vm_public() {\n" + >+ " ^^^^^^^^^^^\n" + >+ "The method vm_public() from the type Visibility.VcPrivate is never used locally\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. WARNING in test\\copy\\VisibilityPackage.java (at line 5)\n" + >+ " public int vf_public = vf_private;\n" + >+ " ^^^^^^^^^\n" + >+ "The field VisibilityPackage.VpPrivate.vf_public is never read locally\n" + >+ "----------\n" + >+ "2. WARNING in test\\copy\\VisibilityPackage.java (at line 10)\n" + >+ " public int vm_public() {\n" + >+ " ^^^^^^^^^^^\n" + >+ "The method vm_public() from the type VisibilityPackage.VpPrivate is never used locally\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. WARNING in test\\copy\\VisibilityPublic.java (at line 5)\n" + >+ " public int vf_public = vf_private;\n" + >+ " ^^^^^^^^^\n" + >+ "The field VisibilityPublic.VpPrivate.vf_public is never read locally\n" + >+ "----------\n" + >+ "2. WARNING in test\\copy\\VisibilityPublic.java (at line 10)\n" + >+ " public int vm_public() {\n" + >+ " ^^^^^^^^^^^\n" + >+ "The method vm_public() from the type VisibilityPublic.VpPrivate is never used locally\n" + >+ "----------\n"; > /* (non-Javadoc) > * @see junit.framework.TestCase#setUp() > */ >@@ -312,6 +360,7 @@ > completedFiles = new String[testFiles.length + referencedClasses.length]; > System.arraycopy(referencedClasses, 0, completedFiles, 0, referencedClasses.length); > System.arraycopy(testFiles, 0, completedFiles, referencedClasses.length, testFiles.length); >+ expected = expectedDiagnosticsFromReferencedClasses + expected; > } > runNegativeTest(completedFiles, expected, javacTestOptions); > } >Index: src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java,v >retrieving revision 1.49 >diff -u -r1.49 InnerEmulationTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java 4 Dec 2008 17:06:22 -0000 1.49 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java 12 Feb 2009 19:39:12 -0000 >@@ -1468,7 +1468,12 @@ > " ^\n" + > "Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" + > "----------\n" + >- "3. ERROR in p1\\A2.java (at line 20)\n" + >+ "3. WARNING in p1\\A2.java (at line 19)\n" + >+ " public void foo() { \n" + >+ " ^^^^^\n" + >+ "The method foo() from the type A2.C is never used locally\n" + >+ "----------\n" + >+ "4. ERROR in p1\\A2.java (at line 20)\n" + > " (new D.E(null, null, null, new F(get()) {}) {}).execute(); \n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "No enclosing instance of type D is accessible. Must qualify the allocation with an enclosing instance of type D (e.g. x.new A() where x is an instance of D).\n" + >@@ -1556,7 +1561,12 @@ > " ^\n" + > "Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" + > "----------\n" + >- "3. ERROR in p1\\A2.java (at line 20)\n" + >+ "3. WARNING in p1\\A2.java (at line 19)\n" + >+ " public void foo() { \n" + >+ " ^^^^^\n" + >+ "The method foo() from the type A2.C is never used locally\n" + >+ "----------\n" + >+ "4. ERROR in p1\\A2.java (at line 20)\n" + > " (new D.E(null, null, null, new F(get()) {})).execute(); \n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "No enclosing instance of type D is accessible. Must qualify the allocation with an enclosing instance of type D (e.g. x.new A() where x is an instance of D).\n" + >@@ -5579,7 +5589,12 @@ > "}", // =================, > }, > "----------\n" + >- "1. ERROR in p\\X.java (at line 11)\n" + >+ "1. WARNING in p\\X.java (at line 5)\n" + >+ " String variable = \"my testing\";\n" + >+ " ^^^^^^^^\n" + >+ "The field X.Outer.Inner.variable is never read locally\n" + >+ "----------\n" + >+ "2. ERROR in p\\X.java (at line 11)\n" + > " Zork z;\n" + > " ^^^^\n" + > "Zork cannot be resolved to a type\n" + >@@ -5633,7 +5648,12 @@ > "}", // =================, > }, > "----------\n" + >- "1. ERROR in p\\X.java (at line 12)\n" + >+ "1. WARNING in p\\X.java (at line 4)\n" + >+ " String variable = \"my testing\";\n" + >+ " ^^^^^^^^\n" + >+ "The field X.Outer.Inner.variable is never read locally\n" + >+ "----------\n" + >+ "2. ERROR in p\\X.java (at line 12)\n" + > " Zork z;\n" + > " ^^^^\n" + > "Zork cannot be resolved to a type\n" + >@@ -6423,22 +6443,27 @@ > " ^^^^^\n" + > "The type X.Test4 is never used locally\n" + > "----------\n" + >- "2. ERROR in X.java (at line 16)\n" + >+ "2. WARNING in X.java (at line 13)\n" + >+ " public Test4() {\n" + >+ " ^^^^^^^\n" + >+ "The constructor X.Test4() is never used locally\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 16)\n" + > " System.out.println(X.this.var1.trim());\n" + > " ^^^^^^\n" + > "No enclosing instance of the type X is accessible in scope\n" + > "----------\n" + >- "3. WARNING in X.java (at line 16)\n" + >+ "4. WARNING in X.java (at line 16)\n" + > " System.out.println(X.this.var1.trim());\n" + > " ^^^^\n" + > "Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + > "----------\n" + >- "4. WARNING in X.java (at line 17)\n" + >+ "5. WARNING in X.java (at line 17)\n" + > " System.out.println(var1.trim());\n" + > " ^^^^\n" + > "Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" + > "----------\n" + >- "5. ERROR in X.java (at line 17)\n" + >+ "6. ERROR in X.java (at line 17)\n" + > " System.out.println(var1.trim());\n" + > " ^^^^\n" + > "No enclosing instance of the type X is accessible in scope\n" + >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.791 >diff -u -r1.791 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 5 Feb 2009 09:40:41 -0000 1.791 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 12 Feb 2009 19:39:12 -0000 >@@ -41220,7 +41220,12 @@ > "The type A.P is not visible\n" + > "----------\n" + > "----------\n" + >- "1. WARNING in p\\A.java (at line 18)\n" + >+ "1. WARNING in p\\A.java (at line 9)\n" + >+ " public int pval;\n" + >+ " ^^^^\n" + >+ "The field A.P.pval is never read locally\n" + >+ "----------\n" + >+ "2. WARNING in p\\A.java (at line 18)\n" + > " this.box.set(new P());\n" + > " ^^^^^^^\n" + > "Access to enclosing constructor A.P() is emulated by a synthetic accessor method\n" + >#P org.eclipse.jdt.core.tests >Index: Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java >=================================================================== >RCS file: /home/cvs/numbat/org.eclipse.jdt.core.tests/Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java,v >retrieving revision 1.321 >diff -u -r1.321 NegativeTest.java >--- Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 26 Nov 2008 17:57:00 -0000 1.321 >+++ Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 12 Feb 2009 19:39:14 -0000 >@@ -7840,12 +7840,22 @@ > " ^^^^^^\n" + > "The type AClass.Inner3 is never used locally\n" + > "----------\n" + >- "2. WARNING in p\\z\\AClass.java (at line 18)\n" + >+ "2. WARNING in p\\z\\AClass.java (at line 14)\n" + >+ " String test() {\n" + >+ " ^^^^^^\n" + >+ "The method test() from the type AClass.Inner3 is never used locally\n" + >+ "----------\n" + >+ "3. WARNING in p\\z\\AClass.java (at line 18)\n" + > " private class Inner4 {\n" + > " ^^^^^^\n" + > "The type AClass.Inner4 is never used locally\n" + > "----------\n" + >- "3. WARNING in p\\z\\AClass.java (at line 31)\n" + >+ "4. WARNING in p\\z\\AClass.java (at line 19)\n" + >+ " String test() {\n" + >+ " ^^^^^^\n" + >+ "The method test() from the type AClass.Inner4 is never used locally\n" + >+ "----------\n" + >+ "5. WARNING in p\\z\\AClass.java (at line 31)\n" + > " public String test() {\n" + > " ^^^^^^\n" + > "The method test() from the type new Object(){} is never used locally\n" + >@@ -9035,7 +9045,13 @@ > " int i = new AA().new Inner().i; // THIS LINE SHOULD CAUSE AN ERROR\n" + > " ^^^^^\n" + > "The type AA.Inner is not visible\n" + >- "----------\n" ); >+ "----------\n" + >+ "----------\n" + >+ "1. WARNING in p\\k\\AA.java (at line 4)\n" + >+ " int i = 10;\n" + >+ " ^\n" + >+ "The field AA.Inner.i is never read locally\n" + >+ "----------\n"); > } > public void test227() { > this.runNegativeTest( >@@ -12204,6 +12220,12 @@ > "} \n", > }, > "----------\n" + >+ "1. WARNING in p\\X.java (at line 4)\n" + >+ " public class Z { \n" + >+ " ^\n" + >+ "The type X.Y.Z is never used locally\n" + >+ "----------\n" + >+ "----------\n" + > "1. ERROR in q\\Y.java (at line 2)\n" + > " import p.X.Y.Z; \n" + > " ^^^^^\n" + >@@ -16481,22 +16503,27 @@ > " ^^^^^^^\n" + > "Access to enclosing constructor X.M() is emulated by a synthetic accessor method\n" + > "----------\n" + >- "4. WARNING in X.java (at line 9)\n" + >+ "4. WARNING in X.java (at line 6)\n" + >+ " M.Member2 m2;\n" + >+ " ^^\n" + >+ "The field X.M.m2 is never read locally\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 9)\n" + > " class Local1 {} \n" + > " ^^^^^^\n" + > "The type Local1 is never used locally\n" + > "----------\n" + >- "5. WARNING in X.java (at line 10)\n" + >+ "6. WARNING in X.java (at line 10)\n" + > " class Local2 { \n" + > " ^^^^^^\n" + > "The type Local2 is never used locally\n" + > "----------\n" + >- "6. WARNING in X.java (at line 11)\n" + >+ "7. WARNING in X.java (at line 11)\n" + > " class LMember1 {} \n" + > " ^^^^^^^^\n" + > "The type Local2.LMember1 is never used locally\n" + > "----------\n" + >- "7. WARNING in X.java (at line 12)\n" + >+ "8. WARNING in X.java (at line 12)\n" + > " class LMember2 extends Local2 { \n" + > " ^^^^^^^^\n" + > "The type Local2.LMember2 is never used locally\n" +
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 201912
:
124945
|
125106
| 125569