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 117699 Details for
Bug 255035
[compiler] Internal compile error gets reported (NPE)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch with testcase
patch.txt (text/plain), 5.44 KB, created by
Kent Johnson
on 2008-11-12 14:51:46 EST
(
hide
)
Description:
Proposed patch with testcase
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2008-11-12 14:51:46 EST
Size:
5.44 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java,v >retrieving revision 1.169 >diff -u -r1.169 MethodVerifyTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 6 Nov 2008 17:22:26 -0000 1.169 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 12 Nov 2008 19:49:27 -0000 >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=255035 >+public void test182() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "class S {\n" + >+ " String foo() { return null; }\n" + >+ "}\n" + >+ "class X extends S {\n" + >+ " foo() { return null; }\n" + >+ " @Override String foo() { return null; }\n" + // should keep this definition >+ " Number foo() { return null; }\n" + >+ " void test() { foo(); }\n" + // no secondary error >+ "}" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " foo() { return null; }\n" + >+ " ^^^^^\n" + >+ "Return type for the method is missing\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 5)\n" + >+ " foo() { return null; }\n" + >+ " ^^^^^\n" + >+ "Duplicate method foo() in type X\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 6)\n" + >+ " @Override String foo() { return null; }\n" + >+ " ^^^^^\n" + >+ "Duplicate method foo() in type X\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 7)\n" + >+ " Number foo() { return null; }\n" + >+ " ^^^^^\n" + >+ "Duplicate method foo() in type X\n" + >+ "----------\n" >+ ); >+} > } >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java,v >retrieving revision 1.169 >diff -u -r1.169 SourceTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 6 Nov 2008 10:15:30 -0000 1.169 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 12 Nov 2008 19:49:28 -0000 >@@ -1165,38 +1165,48 @@ > } > boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES)); > // report duplicate >+ boolean removeMethod2 = true; > if (methodDecl == null) { > methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special > if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method >+ boolean removeMethod = method.returnType == null && method2.returnType != null; > if (isEnumSpecialMethod) { > this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl); > // remove user defined methods & keep the synthetic >+ removeMethod = true; >+ } else { >+ this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2)); >+ } >+ if (removeMethod) { >+ removeMethod2 = false; > methodDecl.binding = null; > // do not alter original method array until resolution is over, due to reentrance (143259) > if (resolvedMethods == this.methods) > System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length); > resolvedMethods[i] = null; > failed++; >- } else { >- this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2)); > } > } > } > AbstractMethodDeclaration method2Decl = method2.sourceMethod(); > if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method >- if (isEnumSpecialMethod) >+ if (isEnumSpecialMethod) { > this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl); >- else >+ removeMethod2 = true; >+ } else { > this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2)); >- method2Decl.binding = null; >- // do not alter original method array until resolution is over, due to reentrance (143259) >- if (resolvedMethods == this.methods) >- System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length); >- resolvedMethods[j] = null; >- failed++; >+ } >+ if (removeMethod2) { >+ method2Decl.binding = null; >+ // do not alter original method array until resolution is over, due to reentrance (143259) >+ if (resolvedMethods == this.methods) >+ System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length); >+ resolvedMethods[j] = null; >+ failed++; >+ } > } > } >- if (method.returnType == null && methodDecl == null) { // forget method with invalid return type... was kept to detect possible collisions >+ if (method.returnType == null && resolvedMethods[i] != null) { // forget method with invalid return type... was kept to detect possible collisions > methodDecl = method.sourceMethod(); > if (methodDecl != null) > methodDecl.binding = null;
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 255035
:
117658
| 117699