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 24363 Details for
Bug 102778
Scrapbook page doesn't work with enhanced for statement
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Regression test
patch_102778_tests.txt (text/plain), 3.87 KB, created by
Olivier Thomann
on 2005-07-05 16:01:40 EDT
(
hide
)
Description:
Regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2005-07-05 16:01:40 EDT
Size:
3.87 KB
patch
obsolete
>Index: src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java,v >retrieving revision 1.24 >diff -u -r1.24 DebugEvaluationTest.java >--- src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java 30 May 2005 15:53:48 -0000 1.24 >+++ src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java 5 Jul 2005 20:01:09 -0000 >@@ -106,6 +106,37 @@ > .append("\""); > org.eclipse.jdt.internal.compiler.batch.Main.compile(buffer.toString()); > } >+ public void compileAndDeploy15(String source, String className) { >+ resetEnv(); // needed to reinitialize the caches >+ File directory = new File(SOURCE_DIRECTORY); >+ if (!directory.exists()) { >+ if (!directory.mkdir()) { >+ System.out.println("Could not create " + SOURCE_DIRECTORY); >+ return; >+ } >+ } >+ String fileName = SOURCE_DIRECTORY + File.separator + className + ".java"; >+ try { >+ BufferedWriter writer = new BufferedWriter(new FileWriter(fileName)); >+ writer.write(source); >+ writer.flush(); >+ writer.close(); >+ } catch(IOException e) { >+ e.printStackTrace(); >+ return; >+ } >+ StringBuffer buffer = new StringBuffer(); >+ buffer >+ .append("\"") >+ .append(fileName) >+ .append("\" -d \"") >+ .append(EvaluationSetup.EVAL_DIRECTORY + File.separator + LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY) >+ .append("\" -nowarn -1.5 -g -classpath \"") >+ .append(Util.getJavaClassLibsAsString()) >+ .append(SOURCE_DIRECTORY) >+ .append("\""); >+ org.eclipse.jdt.internal.compiler.batch.Main.compile(buffer.toString()); >+ } > /** > * Generate local variable attribute for these tests. > */ >@@ -3780,4 +3811,61 @@ > "The final field System.out cannot be assigned|", > buffer == null ? "none" : buffer.toString()); > } >+/** >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=102778 >+ */ >+public void test063() { >+ if (!this.complianceLevel.equals(COMPLIANCE_1_5)) return; >+ try { >+ String sourceA63 = >+ "public class A63 {\n" + >+ " public static void bar() {\n" + >+ " }\n" + >+ "}"; >+ compileAndDeploy15(sourceA63, "A63"); >+ >+ String userCode = "new A63().bar();"; >+ JDIStackFrame stackFrame = >+ new JDIStackFrame(this.jdiVM, this, userCode, "A63", "bar", -1); >+ >+ DebugRequestor requestor = new DebugRequestor(); >+ char[] snippet = ("int[] tab = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9 };\n" + >+ "int sum = 0;\n" + >+ "for (int i : tab) {\n" + >+ " sum += i;\n" + >+ "}\n" + >+ "sum").toCharArray(); >+ Map compilerOpts = getCompilerOptions(); >+ compilerOpts.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); >+ compilerOpts.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); >+ compilerOpts.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_2); >+ >+ try { >+ context.evaluate( >+ snippet, >+ stackFrame.localVariableTypeNames(), >+ stackFrame.localVariableNames(), >+ stackFrame.localVariableModifiers(), >+ stackFrame.declaringTypeName(), >+ stackFrame.isStatic(), >+ stackFrame.isConstructorCall(), >+ getEnv(), >+ compilerOpts, >+ requestor, >+ getProblemFactory()); >+ } catch (InstallException e) { >+ assertTrue("No targetException " + e.getMessage(), false); >+ } >+ assertTrue( >+ "Should get one result but got " + (requestor.resultIndex + 1), >+ requestor.resultIndex == 0); >+ EvaluationResult result = requestor.results[0]; >+ assertTrue("Code snippet should not have problems", !result.hasProblems()); >+ assertTrue("Result should have a value", result.hasValue()); >+ assertEquals("Value", "45".toCharArray(), result.getValueDisplayString()); >+ assertEquals("Type", "int".toCharArray(), result.getValueTypeName()); >+ } finally { >+ removeTempClass("A62"); >+ } >+} > }
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 102778
:
24361
| 24363