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 107631 Details for
Bug 240815
[DOM] CCE in AST#resolveWellKnownType(..) for java.lang.Boolean without rt.jar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests
patch_240815.txt (text/plain), 12.11 KB, created by
Olivier Thomann
on 2008-07-16 11:21:32 EDT
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2008-07-16 11:21:32 EDT
Size:
12.11 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java,v >retrieving revision 1.165 >diff -u -r1.165 DefaultBindingResolver.java >--- dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java 27 Jun 2008 16:03:48 -0000 1.165 >+++ dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java 16 Jul 2008 15:21:08 -0000 >@@ -1656,6 +1656,7 @@ > */ > synchronized ITypeBinding resolveWellKnownType(String name) { > if (this.scope == null) return null; >+ ITypeBinding typeBinding = null; > try { > if (("boolean".equals(name))//$NON-NLS-1$ > || ("char".equals(name))//$NON-NLS-1$ >@@ -1666,49 +1667,52 @@ > || ("float".equals(name))//$NON-NLS-1$ > || ("double".equals(name))//$NON-NLS-1$ > || ("void".equals(name))) {//$NON-NLS-1$ >- return this.getTypeBinding(Scope.getBaseType(name.toCharArray())); >+ typeBinding = this.getTypeBinding(Scope.getBaseType(name.toCharArray())); > } else if ("java.lang.Object".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getJavaLangObject()); >+ typeBinding = this.getTypeBinding(this.scope.getJavaLangObject()); > } else if ("java.lang.String".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getJavaLangString()); >+ typeBinding = this.getTypeBinding(this.scope.getJavaLangString()); > } else if ("java.lang.StringBuffer".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_STRINGBUFFER, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_STRINGBUFFER, 3)); > } else if ("java.lang.Throwable".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getJavaLangThrowable()); >+ typeBinding = this.getTypeBinding(this.scope.getJavaLangThrowable()); > } else if ("java.lang.Exception".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_EXCEPTION, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_EXCEPTION, 3)); > } else if ("java.lang.RuntimeException".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_RUNTIMEEXCEPTION, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_RUNTIMEEXCEPTION, 3)); > } else if ("java.lang.Error".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_ERROR, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_ERROR, 3)); > } else if ("java.lang.Class".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getJavaLangClass()); >+ typeBinding = this.getTypeBinding(this.scope.getJavaLangClass()); > } else if ("java.lang.Cloneable".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getJavaLangCloneable()); >+ typeBinding = this.getTypeBinding(this.scope.getJavaLangCloneable()); > } else if ("java.io.Serializable".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getJavaIoSerializable()); >+ typeBinding = this.getTypeBinding(this.scope.getJavaIoSerializable()); > } else if ("java.lang.Boolean".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_BOOLEAN, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_BOOLEAN, 3)); > } else if ("java.lang.Byte".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_BYTE, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_BYTE, 3)); > } else if ("java.lang.Character".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_CHARACTER, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_CHARACTER, 3)); > } else if ("java.lang.Double".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_DOUBLE, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_DOUBLE, 3)); > } else if ("java.lang.Float".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_FLOAT, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_FLOAT, 3)); > } else if ("java.lang.Integer".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_INTEGER, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_INTEGER, 3)); > } else if ("java.lang.Long".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_LONG, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_LONG, 3)); > } else if ("java.lang.Short".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_SHORT, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_SHORT, 3)); > } else if ("java.lang.Void".equals(name)) {//$NON-NLS-1$ >- return this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_VOID, 3)); >+ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_VOID, 3)); > } > } catch (AbortCompilation e) { > // ignore missing types > } >+ if (typeBinding != null && !typeBinding.isRecovered()) { >+ return typeBinding; >+ } > return null; > } > >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.337 >diff -u -r1.337 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 7 Jul 2008 13:08:21 -0000 1.337 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 16 Jul 2008 15:21:07 -0000 >@@ -2230,10 +2230,17 @@ > char[][] qName = new char[][] { compoundName[0] }; > return new ProblemReferenceBinding(qName, environment().createMissingType(compilationUnitScope().getCurrentPackage(), qName), ProblemReasons.NotFound); > } >+ int currentIndex = 1; > if (!binding.isValidBinding()) { >+ if (binding instanceof PackageBinding) { >+ char[][] qName = CharOperation.subarray(compoundName, 0, currentIndex); >+ return new ProblemReferenceBinding( >+ qName, >+ environment().createMissingType(null, qName), >+ ProblemReasons.NotFound); >+ } > return (ReferenceBinding) binding; > } >- int currentIndex = 1; > boolean checkVisibility = false; > if (binding instanceof PackageBinding) { > PackageBinding packageBinding = (PackageBinding) binding; >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java,v >retrieving revision 1.142 >diff -u -r1.142 ASTConverterTestAST3_2.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 27 Jun 2008 16:02:37 -0000 1.142 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 16 Jul 2008 15:21:09 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.core.runtime.OperationCanceledException; > import org.eclipse.jdt.core.Flags; > import org.eclipse.jdt.core.IClassFile; >+import org.eclipse.jdt.core.IClasspathEntry; > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IField; > import org.eclipse.jdt.core.IInitializer; >@@ -121,7 +122,7 @@ > static { > // TESTS_NAMES = new String[] {"test0602"}; > // TESTS_RANGE = new int[] { 670, -1 }; >-// TESTS_NUMBERS = new int[] { 688 }; >+// TESTS_NUMBERS = new int[] { 689, 690 }; > } > public static Test suite() { > return buildModelTestSuite(ASTConverterTestAST3_2.class); >@@ -9722,4 +9723,56 @@ > ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); > assertNotNull(result); > } >+ /** >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=240815 >+ */ >+ public void test0689() throws JavaModelException { >+ IJavaProject project = getJavaProject("Converter"); >+ if (project == null) { >+ return; >+ } >+ // replace JCL_LIB with JCL15_LIB, and JCL_SRC with JCL15_SRC >+ IClasspathEntry[] classpath = project.getRawClasspath(); >+ ArrayList newClasspathEntries = new ArrayList(); >+ for (int i = 0, length = classpath.length; i < length; i++) { >+ IClasspathEntry entry = classpath[i]; >+ if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE) { >+ newClasspathEntries.add(entry); >+ } >+ } >+ IClasspathEntry[] newClasspath = new IClasspathEntry[newClasspathEntries.size()]; >+ newClasspathEntries.toArray(newClasspath); >+ project.setRawClasspath(newClasspath, null); >+ ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0689", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >+ ASTNode result = runConversion(AST.JLS3, sourceUnit, true, true); >+ assertNotNull(result); >+ ITypeBinding typeBinding = result.getAST().resolveWellKnownType("java.lang.Boolean"); >+ assertNull("Should be null", typeBinding); >+ } >+ /** >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=240815 >+ */ >+ public void test0690() throws JavaModelException { >+ IJavaProject project = getJavaProject("Converter"); >+ if (project == null) { >+ return; >+ } >+ // replace JCL_LIB with JCL15_LIB, and JCL_SRC with JCL15_SRC >+ IClasspathEntry[] classpath = project.getRawClasspath(); >+ ArrayList newClasspathEntries = new ArrayList(); >+ for (int i = 0, length = classpath.length; i < length; i++) { >+ IClasspathEntry entry = classpath[i]; >+ if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE) { >+ newClasspathEntries.add(entry); >+ } >+ } >+ IClasspathEntry[] newClasspath = new IClasspathEntry[newClasspathEntries.size()]; >+ newClasspathEntries.toArray(newClasspath); >+ project.setRawClasspath(newClasspath, null); >+ ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0690", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >+ ASTNode result = runConversion(AST.JLS3, sourceUnit, true, true, true); >+ assertNotNull(result); >+ ITypeBinding typeBinding = result.getAST().resolveWellKnownType("java.lang.Boolean"); >+ assertNull("Should be null", typeBinding); >+ } > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/plugin.xml,v >retrieving revision 1.32 >diff -u -r1.32 plugin.xml >--- plugin.xml 11 Jan 2008 12:42:49 -0000 1.32 >+++ plugin.xml 16 Jul 2008 15:21:08 -0000 >@@ -38,7 +38,7 @@ > </extension> > > <!-- Extra Java-like file extensions --> >- <extension point="org.eclipse.core.runtime.contentTypes"> >+ <extension point="org.eclipse.core.contenttype.contentTypes"> > <file-association > content-type="org.eclipse.jdt.core.javaSource" > file-extensions="foo,bar"/> >Index: workspace/Converter/src/test0690/X.java >=================================================================== >RCS file: workspace/Converter/src/test0690/X.java >diff -N workspace/Converter/src/test0690/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter/src/test0690/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package test0690; >+public class X { >+} >Index: workspace/Converter/src/test0689/X.java >=================================================================== >RCS file: workspace/Converter/src/test0689/X.java >diff -N workspace/Converter/src/test0689/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter/src/test0689/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package test0689; >+public class X { >+}
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 240815
:
107631
|
107635
|
107639