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 59173 Details for
Bug 102473
code assist: parameter names not harvested from debug info in class files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Regression tests
patch_102473_tests.txt (text/plain), 7.91 KB, created by
Olivier Thomann
on 2007-02-16 12:38:58 EST
(
hide
)
Description:
Regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2007-02-16 12:38:58 EST
Size:
7.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_4.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_4.java,v >retrieving revision 1.8 >diff -u -r1.8 ClassFileReaderTest_1_4.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_4.java 13 Feb 2007 19:42:00 -0000 1.8 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_4.java 16 Feb 2007 17:38:01 -0000 >@@ -14,13 +14,15 @@ > > import junit.framework.Test; > >+import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.core.util.ClassFileBytesDisassembler; > import org.eclipse.jdt.core.util.ClassFormatException; >+import org.eclipse.jdt.internal.compiler.env.IBinaryMethod; > > public class ClassFileReaderTest_1_4 extends AbstractRegressionTest { > static { > // TESTS_NAMES = new String[] { "test127" }; >-// TESTS_NUMBERS = new int[] { 77 }; >+// TESTS_NUMBERS = new int[] { 78, 79 }; > // TESTS_RANGE = new int[] { 169, 180 }; > } > >@@ -66,7 +68,7 @@ > " Local variable table:\n" + > " [pc: 0, pc: 12] local: this index: 0 type: A001\n"; > checkClassFile("A001", source, expectedOutput); >- } >+ } > > /** > * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25188 >@@ -2785,4 +2787,102 @@ > "private static class p.X$A {\n"; > checkClassFile("p", "X", "X$A", source, expectedOutput, ClassFileBytesDisassembler.DETAILED | ClassFileBytesDisassembler.COMPACT); > } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=34373 >+ public void test078() throws ClassFormatException, IOException { >+ String source = >+ "public class X {\n" + >+ " X(int i, int j) {}\n" + >+ " void foo(String s, double d) {}\n" + >+ "}"; >+ org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source); >+ IBinaryMethod[] methodInfos = classFileReader.getMethods(); >+ assertNotNull("No method infos", methodInfos); >+ int length = methodInfos.length; >+ assertTrue("At least one method", length > 0); >+ for (int i = 0; i < length; i++) { >+ char[][] argNames = methodInfos[i].getArgumentNames(); >+ assertNotNull("No names", argNames); >+ assertEquals("Wrong size", 2, argNames.length); >+ if (CharOperation.equals(methodInfos[i].getSelector(), "<init>".toCharArray())) { >+ assertEquals("Wrong argument name", "i", new String(argNames[0])); >+ assertEquals("Wrong argument name", "j", new String(argNames[1])); >+ } else if (CharOperation.equals(methodInfos[i].getSelector(), "foo".toCharArray())) { >+ assertEquals("Wrong argument name", "s", new String(argNames[0])); >+ assertEquals("Wrong argument name", "d", new String(argNames[1])); >+ } >+ } >+ } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=34373 >+ public void test079() throws ClassFormatException, IOException { >+ String source = >+ "public class X {\n" + >+ " X(int i, int j) {}\n" + >+ " void foo(String s, double d) throws Exception {\n" + >+ " try {\n" + >+ " System.out.println(s + d);\n" + >+ " } catch(Exception e) {\n" + >+ " e.printStackTrace();\n" + >+ " throw e;\n" + >+ " } finally {\n" + >+ " System.out.println(\"done\");\n" + >+ " }\n" + >+ " }\n" + >+ "}"; >+ org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source); >+ IBinaryMethod[] methodInfos = classFileReader.getMethods(); >+ assertNotNull("No method infos", methodInfos); >+ int length = methodInfos.length; >+ assertTrue("At least one method", length > 0); >+ for (int i = 0; i < length; i++) { >+ char[][] argNames = methodInfos[i].getArgumentNames(); >+ assertNotNull("No names", argNames); >+ assertEquals("Wrong size", 2, argNames.length); >+ if (CharOperation.equals(methodInfos[i].getSelector(), "<init>".toCharArray())) { >+ assertEquals("Wrong argument name", "i", new String(argNames[0])); >+ assertEquals("Wrong argument name", "j", new String(argNames[1])); >+ } else if (CharOperation.equals(methodInfos[i].getSelector(), "foo".toCharArray())) { >+ assertEquals("Wrong argument name", "s", new String(argNames[0])); >+ assertEquals("Wrong argument name", "d", new String(argNames[1])); >+ } >+ } >+ } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=34373 >+ public void test080() throws ClassFormatException, IOException { >+ String source = >+ "public class X {\n" + >+ " X(int i, int j) {}\n" + >+ " void foo(String s, double d) throws Exception {\n" + >+ " try {\n" + >+ " int k = 0;\n" + >+ " System.out.println(s + d + k);\n" + >+ " } catch(Exception e) {\n" + >+ " e.printStackTrace();\n" + >+ " throw e;\n" + >+ " } finally {\n" + >+ " System.out.println(\"done\");\n" + >+ " }\n" + >+ " }\n" + >+ "}"; >+ org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source); >+ IBinaryMethod[] methodInfos = classFileReader.getMethods(); >+ assertNotNull("No method infos", methodInfos); >+ int length = methodInfos.length; >+ assertTrue("At least one method", length > 0); >+ for (int i = 0; i < length; i++) { >+ char[][] argNames = methodInfos[i].getArgumentNames(); >+ assertNotNull("No names", argNames); >+ assertEquals("Wrong size", 2, argNames.length); >+ if (CharOperation.equals(methodInfos[i].getSelector(), "<init>".toCharArray())) { >+ assertEquals("Wrong argument name", "i", new String(argNames[0])); >+ assertEquals("Wrong argument name", "j", new String(argNames[1])); >+ } else if (CharOperation.equals(methodInfos[i].getSelector(), "foo".toCharArray())) { >+ assertEquals("Wrong argument name", "s", new String(argNames[0])); >+ assertEquals("Wrong argument name", "d", new String(argNames[1])); >+ } >+ } >+ } >+ > } >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java,v >retrieving revision 1.73 >diff -u -r1.73 AbstractRegressionTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java 13 Feb 2007 19:42:00 -0000 1.73 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java 16 Feb 2007 17:38:01 -0000 >@@ -162,6 +162,32 @@ > this.checkClassFile(directoryName, className, className, source, expectedOutput, mode); > } > >+ protected ClassFileReader getInternalClassFile(String directoryName, String className, String disassembledClassName, String source) throws ClassFormatException, IOException { >+ compileAndDeploy(source, directoryName, className); >+ try { >+ File directory = new File(EVAL_DIRECTORY, directoryName); >+ if (!directory.exists()) { >+ assertTrue(".class file not generated properly in " + directory, false); >+ } >+ File f = new File(directory, disassembledClassName + ".class"); >+ ClassFileReader classFileReader = null; >+ try { >+ FileInputStream stream = new FileInputStream(f); >+ classFileReader = ClassFileReader.read(stream, className + ".class", true); >+ stream.close(); >+ } catch (org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException e) { >+ e.printStackTrace(); >+ assertTrue("ClassFormatException", false); >+ } catch (IOException e) { >+ e.printStackTrace(); >+ assertTrue("IOException", false); >+ } >+ return classFileReader; >+ } finally { >+ removeTempClass(className); >+ } >+ } >+ > protected void checkDisassembledClassFile(String fileName, String className, String expectedOutput) { > this.checkDisassembledClassFile(fileName, className, expectedOutput, ClassFileBytesDisassembler.DETAILED); > }
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 102473
:
59172
| 59173