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 54183 Details for
Bug 164707
ArrayIndexOutOfBoundsException in JavaModelManager if source level == 6.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
New proposed patch
v01.txt (text/plain), 5.08 KB, created by
Frederic Fusier
on 2006-11-20 12:46:43 EST
(
hide
)
Description:
New proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2006-11-20 12:46:43 EST
Size:
5.08 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.344 >diff -u -r1.344 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 6 Nov 2006 14:13:45 -0000 1.344 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 20 Nov 2006 17:35:43 -0000 >@@ -42,6 +42,7 @@ > import org.eclipse.jdt.internal.codeassist.CompletionEngine; > import org.eclipse.jdt.internal.codeassist.SelectionEngine; > import org.eclipse.jdt.internal.compiler.Compiler; >+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.env.AccessRestriction; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt; >@@ -329,7 +330,14 @@ > */ > private int indexForSourceLevel(String sourceLevel) { > if (sourceLevel == null) return 0; >- return sourceLevel.charAt(2) - 49; >+ long jdkLevel = CompilerOptions.versionToJdkLevel(sourceLevel); >+ if (jdkLevel == 0) { >+ if (VERBOSE) { >+ System.out.println(sourceLevel+" is not a valid compiler source level (1.1 -> 1.6 expected)"); //$NON-NLS-1$ >+ } >+ return 0; >+ } >+ return ((int)(jdkLevel >>> 16)) - ClassFileConstants.MAJOR_VERSION_1_1; > } > > private int sortParticipants(ArrayList group, IConfigurationElement[] configElements, int index) { >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.171 >diff -u -r1.171 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 18 Oct 2006 19:09:56 -0000 1.171 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 20 Nov 2006 17:35:43 -0000 >@@ -832,18 +832,27 @@ > } > } > public static long versionToJdkLevel(Object versionID) { >- if (VERSION_1_1.equals(versionID)) { >- return ClassFileConstants.JDK1_1; >- } else if (VERSION_1_2.equals(versionID)) { >- return ClassFileConstants.JDK1_2; >- } else if (VERSION_1_3.equals(versionID)) { >- return ClassFileConstants.JDK1_3; >- } else if (VERSION_1_4.equals(versionID) || VERSION_JSR14.equals(versionID)) { >- return ClassFileConstants.JDK1_4; >- } else if (VERSION_1_5.equals(versionID)) { >- return ClassFileConstants.JDK1_5; >- } else if (VERSION_1_6.equals(versionID)) { >- return ClassFileConstants.JDK1_6; >+ if (versionID instanceof String) { >+ String version = (String) versionID; >+ // verification is optimized using the fact that all versions have same length and start with "1." >+ if (version.length() == 3 && version.charAt(0) == '1' && version.charAt(1) == '.') { >+ switch (version.charAt(2)) { >+ case '1': >+ return ClassFileConstants.JDK1_1; >+ case '2': >+ return ClassFileConstants.JDK1_2; >+ case '3': >+ return ClassFileConstants.JDK1_3; >+ case '4': >+ return ClassFileConstants.JDK1_4; >+ case '5': >+ return ClassFileConstants.JDK1_5; >+ case '6': >+ return ClassFileConstants.JDK1_6; >+ default: >+ return 0; // unknown >+ } >+ } > } > return 0; // unknown > } >#P org.eclipse.jdt.core.tests.builder >Index: src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java,v >retrieving revision 1.21 >diff -u -r1.21 BasicBuildTests.java >--- src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java 29 Mar 2006 03:16:23 -0000 1.21 >+++ src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java 20 Nov 2006 17:35:44 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.core.resources.IMarker; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; >+import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.tests.util.Util; >@@ -402,4 +403,18 @@ > fullBuild(projectPath); > expectingNoProblems(); > } >+ >+ /** >+ * @bug 164707: ArrayIndexOutOfBoundsException in JavaModelManager if source level == 6.0 >+ * @test Ensure that AIIOB does not longer happen with invalid source level string >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=164707" >+ */ >+ public void testBug164707() throws JavaModelException { >+ IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ >+ IJavaProject javaProject = env.getJavaProject(projectPath); >+ javaProject.setOption(JavaCore.COMPILER_SOURCE, "invalid"); >+ env.addExternalJars(projectPath, Util.getJavaClassLibs()); >+ fullBuild(projectPath); >+ expectingNoProblems(); >+ } > }
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 164707
:
54171
|
54183
|
54244
|
54255