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 116109 Details for
Bug 250975
[1.5][compiler] Stack overflow on static import.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed patch for 3.4
250975-34x.txt (text/plain), 13.96 KB, created by
Philipe Mulet
on 2008-10-24 16:24:03 EDT
(
hide
)
Description:
Proposed patch for 3.4
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2008-10-24 16:24:03 EDT
Size:
13.96 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java,v >retrieving revision 1.9 >diff -u -r1.9 CodeSnippetClassLoader.java >--- src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java 10 May 2006 18:07:27 -0000 1.9 >+++ src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java 24 Oct 2008 20:23:19 -0000 >@@ -40,7 +40,7 @@ > * If only the class definition is known to this runner, makes it a class and returns it. > * Otherwise delegates to the real class loader. > */ >-protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { >+protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { > if (DEVELOPMENT_MODE) { > try { > return delegateLoadClass(name); >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.69 >diff -u -r1.69 StaticImportTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java 6 Jun 2008 12:04:42 -0000 1.69 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java 24 Oct 2008 20:23:19 -0000 >@@ -2404,5 +2404,90 @@ > }, > ""); > } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=250211 >+ public void test070() { >+ this.runConformTest( >+ new String[] { >+ "node/Test.java",//------------------------------ >+ "package node;\n" + >+ "public class Test {\n" + >+ " public static void node() {}\n" + >+ "}\n", >+ "node2/Test2.java",//------------------------------ >+ "package node2;\n" + >+ "import static node.Test.node;\n" + >+ "public class Test2 {\n" + >+ "}\n", >+ }, >+ ""); >+ } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=250211 - variation >+ public void test071() { >+ this.runNegativeTest( >+ new String[] { >+ "node/Test/node.java",//------------------------------ >+ "package node.Test;\n" + >+ "public class node {\n" + >+ "}\n", >+ "node/Test.java",//------------------------------ >+ "package node;\n" + >+ "public class Test {\n" + >+ " public static void node() {}\n" + >+ "}\n", >+ "node2/Test2.java",//------------------------------ >+ "package node2;\n" + >+ "import node.Test;\n" + >+ "import static Test.node;\n" + >+ "public class Test2 {\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. WARNING in node\\Test.java (at line 2)\n" + >+ " public class Test {\n" + >+ " ^^^^\n" + >+ "The type Test collides with a package\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. ERROR in node2\\Test2.java (at line 3)\n" + >+ " import static Test.node;\n" + >+ " ^^^^\n" + >+ "The import Test cannot be resolved\n" + >+ "----------\n"); >+ } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=93913 - variation >+ public void test072() { >+ this.runNegativeTest( >+ new String[] { >+ "p1/A.java", >+ "package p1;\n" + >+ "import static p2.C.B;\n" + >+ "public class A extends B {\n" + >+ " void test() {" + >+ " int i = B;\n" + >+ " B b = null;\n" + >+ " int v1 = b.fooB;\n" + >+ " int v2 = b.fooC;\n" + >+ " int v3 = fooC;\n" + >+ " }\n" + >+ "}\n", >+ "p1/B.java", >+ "package p1;\n" + >+ "public class B {\n" + >+ " public int fooB;\n" + >+ "}\n", >+ "p2/C.java", >+ "package p2;\n" + >+ "public class C {\n" + >+ " public static class B { public int fooC; }\n" + >+ " public static int B;\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in p1\\A.java (at line 7)\n" + >+ " int v2 = b.fooC;\n" + >+ " ^^^^^^\n" + >+ "b.fooC cannot be resolved or is not a field\n" + >+ "----------\n"); >+ } > } > >Index: src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java,v >retrieving revision 1.73.2.1 >diff -u -r1.73.2.1 LookupTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 4 Jul 2008 20:27:03 -0000 1.73.2.1 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 24 Oct 2008 20:23:14 -0000 >@@ -2935,6 +2935,100 @@ > "The type X cannot be a superinterface of Member; a superinterface must be an interface\n" + > "----------\n"); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=250211 - variation >+public void test091() { >+ this.runNegativeTest( >+ new String[] { >+ "foo/Test.java",//------------------------------ >+ "package foo;\n" + >+ "public class Test {\n" + >+ " public class M1 {\n" + >+ " public class M2 {}\n" + >+ " }\n" + >+ "}\n", >+ "bar/Test2.java",//------------------------------ >+ "package bar;\n" + >+ "import foo.Test;\n" + >+ "import Test.M1.M2;\n" + >+ "public class Test2 {\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in bar\\Test2.java (at line 3)\n" + >+ " import Test.M1.M2;\n" + >+ " ^^^^\n" + >+ "The import Test cannot be resolved\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=250211 - variation >+public void test092() { >+ this.runNegativeTest( >+ new String[] { >+ "foo/Test.java",//------------------------------ >+ "package foo;\n" + >+ "public class Test {\n" + >+ " public class M1 {\n" + >+ " public class M2 {}\n" + >+ " }\n" + >+ "}\n", >+ "bar/Test2.java",//------------------------------ >+ "package bar;\n" + >+ "import foo.*;\n" + >+ "import Test.M1.M2;\n" + >+ "public class Test2 {\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in bar\\Test2.java (at line 3)\n" + >+ " import Test.M1.M2;\n" + >+ " ^^^^\n" + >+ "The import Test cannot be resolved\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=250211 - variation >+public void test093() { >+ this.runNegativeTest( >+ new String[] { >+ "foo/Test.java",//------------------------------ >+ "package foo;\n" + >+ "public class Test {\n" + >+ " public class M1 {\n" + >+ " public class foo {}\n" + >+ " }\n" + >+ "}\n", >+ "bar/Test2.java",//------------------------------ >+ "package bar;\n" + >+ "import foo.Test;\n" + >+ "import Test.M1.foo;\n" + >+ "public class Test2 {\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in bar\\Test2.java (at line 3)\n" + >+ " import Test.M1.foo;\n" + >+ " ^^^^\n" + >+ "The import Test cannot be resolved\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=250211 - variation >+public void test094() { >+ this.runConformTest( >+ new String[] { >+ "foo/Test.java",//------------------------------ >+ "package foo;\n" + >+ "public class Test {\n" + >+ " public class M1 {\n" + >+ " public class foo {}\n" + >+ " }\n" + >+ "}\n", >+ "bar/Test2.java",//------------------------------ >+ "package bar;\n" + >+ "import foo.Test.M1.foo;\n" + >+ "public class Test2 {\n" + >+ "}\n", >+ }, >+ ""); >+} > public static Class testClass() { return LookupTest.class; > } > } >#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.118 >diff -u -r1.118 CompilationUnitScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 27 May 2008 22:21:12 -0000 1.118 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 24 Oct 2008 20:23:29 -0000 >@@ -356,7 +356,7 @@ > } > resolvedImports[index++] = new ImportBinding(compoundName, true, importBinding, importReference); > } else { >- Binding importBinding = findSingleImport(compoundName, importReference.isStatic()); >+ Binding importBinding = findSingleImport(compoundName, Binding.TYPE | Binding.FIELD | Binding.METHOD, importReference.isStatic()); > if (!importBinding.isValidBinding()) { > if (importBinding.problemId() == ProblemReasons.Ambiguous) { > // keep it unless a duplicate can be found below >@@ -442,7 +442,7 @@ > if(onDemand) { > return findImport(compoundName, compoundName.length); > } else { >- return findSingleImport(compoundName, findStaticImports); >+ return findSingleImport(compoundName, Binding.TYPE | Binding.FIELD | Binding.METHOD, findStaticImports); > } > } > private Binding findImport(char[][] compoundName, int length) { >@@ -493,7 +493,7 @@ > return new ProblemReferenceBinding(compoundName, type, ProblemReasons.NotVisible); > return type; > } >-private Binding findSingleImport(char[][] compoundName, boolean findStaticImports) { >+private Binding findSingleImport(char[][] compoundName, int mask, boolean findStaticImports) { > if (compoundName.length == 1) { > // findType records the reference > // the name cannot be a package >@@ -506,10 +506,10 @@ > } > > if (findStaticImports) >- return findSingleStaticImport(compoundName); >+ return findSingleStaticImport(compoundName, mask); > return findImport(compoundName, compoundName.length); > } >-private Binding findSingleStaticImport(char[][] compoundName) { >+private Binding findSingleStaticImport(char[][] compoundName, int mask) { > Binding binding = findImport(compoundName, compoundName.length - 1); > if (!binding.isValidBinding()) return binding; > >@@ -523,7 +523,7 @@ > > // look to see if its a static field first > ReferenceBinding type = (ReferenceBinding) binding; >- FieldBinding field = findField(type, name, null, true); >+ FieldBinding field = (mask & Binding.FIELD) != 0 ? findField(type, name, null, true) : null; > if (field != null) { > if (field.problemId() == ProblemReasons.Ambiguous && ((ProblemFieldBinding) field).closestMatch.isStatic()) > return field; // keep the ambiguous field instead of a possible method match >@@ -532,7 +532,7 @@ > } > > // look to see if there is a static method with the same selector >- MethodBinding method = findStaticMethod(type, name); >+ MethodBinding method = (mask & Binding.METHOD) != 0 ? findStaticMethod(type, name) : null; > if (method != null) return method; > > type = findMemberType(name, type); >@@ -589,7 +589,7 @@ > public final Binding getImport(char[][] compoundName, boolean onDemand, boolean isStaticImport) { > if (onDemand) > return findImport(compoundName, compoundName.length); >- return findSingleImport(compoundName, isStaticImport); >+ return findSingleImport(compoundName, Binding.TYPE | Binding.FIELD | Binding.METHOD, isStaticImport); > } > > public int nextCaptureID() { >@@ -708,9 +708,9 @@ > referencedTypes.add(actualType); > } > } >-Binding resolveSingleImport(ImportBinding importBinding) { >+Binding resolveSingleImport(ImportBinding importBinding, int mask) { > if (importBinding.resolvedImport == null) { >- importBinding.resolvedImport = findSingleImport(importBinding.compoundName, importBinding.isStatic()); >+ importBinding.resolvedImport = findSingleImport(importBinding.compoundName, mask, importBinding.isStatic()); > if (!importBinding.resolvedImport.isValidBinding() || importBinding.resolvedImport instanceof PackageBinding) { > if (importBinding.resolvedImport.problemId() == ProblemReasons.Ambiguous) > return importBinding.resolvedImport; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.333.2.3 >diff -u -r1.333.2.3 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 7 Jul 2008 13:18:28 -0000 1.333.2.3 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 24 Oct 2008 20:23:37 -0000 >@@ -1576,7 +1576,7 @@ > ImportBinding importBinding = imports[i]; > if (importBinding.isStatic() && !importBinding.onDemand) { > if (CharOperation.equals(importBinding.compoundName[importBinding.compoundName.length - 1], name)) { >- if (unitScope.resolveSingleImport(importBinding) != null && importBinding.resolvedImport instanceof FieldBinding) { >+ if (unitScope.resolveSingleImport(importBinding, Binding.TYPE | Binding.FIELD | Binding.METHOD) != null && importBinding.resolvedImport instanceof FieldBinding) { > foundField = (FieldBinding) importBinding.resolvedImport; > ImportReference importReference = importBinding.reference; > if (importReference != null && needResolve) { >@@ -2437,12 +2437,8 @@ > ImportBinding importBinding = imports[i]; > if (!importBinding.onDemand) { > if (CharOperation.equals(importBinding.compoundName[importBinding.compoundName.length - 1], name)) { >- Binding resolvedImport = unitScope.resolveSingleImport(importBinding); >+ Binding resolvedImport = unitScope.resolveSingleImport(importBinding, Binding.TYPE); > if (resolvedImport == null) continue nextImport; >- if (resolvedImport instanceof MethodBinding) { >- resolvedImport = getType(importBinding.compoundName, importBinding.compoundName.length); >- if (!resolvedImport.isValidBinding()) continue nextImport; >- } > if (resolvedImport instanceof TypeBinding) { > ImportReference importReference = importBinding.reference; > if (importReference != 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 250975
:
115167
|
116082
| 116109