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 93065 Details for
Bug 183211
[1.5][compiler] single static import for a field is ambiguous
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
New proposed patch
patch.txt (text/plain), 4.59 KB, created by
Kent Johnson
on 2008-03-20 16:10:10 EDT
(
hide
)
Description:
New proposed patch
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2008-03-20 16:10:10 EDT
Size:
4.59 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java,v >retrieving revision 1.63 >diff -u -r1.63 StaticImportTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java 19 Mar 2008 18:38:41 -0000 1.63 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java 20 Mar 2008 20:08:28 -0000 >@@ -2259,5 +2259,29 @@ > "----------\n" > ); > } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=183211 - variation >+ public void test064() { >+ this.runNegativeTest( >+ new String[] { >+ "p1/X.java", >+ "package p1;\n" + >+ "import static p2.A.M;\n" + >+ "public class X {\n" + >+ " M m;\n" + >+ "}\n", >+ "p2/A.java", >+ "package p2;\n" + >+ "interface I { class M {} }\n" + >+ "class B { public static class M {} }\n" + >+ "public class A extends B implements I {}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in p1\\X.java (at line 4)\n" + >+ " M m;\n" + >+ " ^\n" + >+ "The type M is ambiguous\n" + >+ "----------\n" >+ ); >+ } > } > >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java,v >retrieving revision 1.115 >diff -u -r1.115 CompilationUnitScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 19 Mar 2008 18:38:42 -0000 1.115 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 20 Mar 2008 20:08:28 -0000 >@@ -358,7 +358,7 @@ > } else { > Binding importBinding = findSingleImport(compoundName, importReference.isStatic()); > if (!importBinding.isValidBinding()) { >- if (importBinding instanceof ProblemFieldBinding && importBinding.problemId() == ProblemReasons.Ambiguous) { >+ if (importBinding.problemId() == ProblemReasons.Ambiguous) { > // keep it unless a duplicate can be found below > } else { > problemReporter().importProblem(importReference, importBinding); >@@ -378,8 +378,11 @@ > // collisions between an imported static field & a type should be checked according to spec... but currently not by javac > if (importBinding instanceof ReferenceBinding || conflictingType != null) { > ReferenceBinding referenceBinding = conflictingType == null ? (ReferenceBinding) importBinding : conflictingType; >- if (importReference.isTypeUseDeprecated(referenceBinding, this)) >- problemReporter().deprecatedType(referenceBinding, importReference); >+ ReferenceBinding typeToCheck = referenceBinding.problemId() == ProblemReasons.Ambiguous >+ ? ((ProblemReferenceBinding) referenceBinding).closestMatch >+ : referenceBinding; >+ if (importReference.isTypeUseDeprecated(typeToCheck, this)) >+ problemReporter().deprecatedType(typeToCheck, importReference); > > ReferenceBinding existingType = typesBySimpleNames.get(compoundName[compoundName.length - 1]); > if (existingType != null) { >@@ -538,8 +541,10 @@ > return field; > return new ProblemReferenceBinding(compoundName, type, ProblemReasons.NotFound); > } >- if (!type.canBeSeenBy(fPackage)) >+ if (type.isValidBinding() && !type.canBeSeenBy(fPackage)) > return new ProblemReferenceBinding(compoundName, type, ProblemReasons.NotVisible); >+ if (type.problemId() == ProblemReasons.NotVisible) // ensure compoundName is correct >+ return new ProblemReferenceBinding(compoundName, ((ProblemReferenceBinding) type).closestMatch, ProblemReasons.NotVisible); > return type; > } > MethodBinding findStaticMethod(ReferenceBinding currentType, char[] selector) { >@@ -707,7 +712,7 @@ > if (importBinding.resolvedImport == null) { > importBinding.resolvedImport = findSingleImport(importBinding.compoundName, importBinding.isStatic()); > if (!importBinding.resolvedImport.isValidBinding() || importBinding.resolvedImport instanceof PackageBinding) { >- if (importBinding.resolvedImport instanceof ProblemFieldBinding && importBinding.resolvedImport.problemId() == ProblemReasons.Ambiguous) >+ if (importBinding.resolvedImport.problemId() == ProblemReasons.Ambiguous) > return importBinding.resolvedImport; > if (this.imports != null) { > ImportBinding[] newImports = new ImportBinding[imports.length - 1];
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 183211
:
64321
|
92861
|
92938
| 93065