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 25243 Details for
Bug 104738
[1.5][compiler] Enclosing method attribute is generated for member type of a local type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Regression test
patch_104738_tests_compiler.txt (text/plain), 4.84 KB, created by
Olivier Thomann
on 2005-07-25 10:46:10 EDT
(
hide
)
Description:
Regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2005-07-25 10:46:10 EDT
Size:
4.84 KB
patch
obsolete
>Index: src/org/eclipse/jdt/core/tests/compiler/regression/RunComparableTests.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RunComparableTests.java,v >retrieving revision 1.2 >diff -u -r1.2 RunComparableTests.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/RunComparableTests.java 23 Feb 2005 02:52:37 -0000 1.2 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/RunComparableTests.java 25 Jul 2005 14:44:16 -0000 >@@ -38,6 +38,7 @@ > ALL_CLASSES.add(EnumTest.class); > ALL_CLASSES.add(MethodVerifyTest.class); > ALL_CLASSES.add(AnnotationTest.class); >+ ALL_CLASSES.add(EnclosingMethodAttributeTest.class); > // Reset forgotten subsets tests > TestCase.TESTS_PREFIX = null; > TestCase.TESTS_NAMES = null; >Index: src/org/eclipse/jdt/core/tests/compiler/regression/EnclosingMethodAttributeTest.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/compiler/regression/EnclosingMethodAttributeTest.java >diff -N src/org/eclipse/jdt/core/tests/compiler/regression/EnclosingMethodAttributeTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/EnclosingMethodAttributeTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,96 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.compiler.regression; >+ >+import java.io.File; >+import java.io.IOException; >+ >+import org.eclipse.jdt.core.ToolFactory; >+import org.eclipse.jdt.core.tests.util.Util; >+import org.eclipse.jdt.core.util.ClassFileBytesDisassembler; >+ >+import junit.framework.Test; >+ >+public class EnclosingMethodAttributeTest extends AbstractComparableTest { >+ public EnclosingMethodAttributeTest(String name) { >+ super(name); >+ } >+ >+ // Static initializer to specify tests subset using TESTS_* static variables >+ // All specified tests which does not belong to the class are skipped... >+ static { >+// TESTS_NAMES = new String[] { "test127" }; >+// TESTS_NUMBERS = new int[] { 176 }; >+// TESTS_RANGE = new int[] { 169, 180 }; >+ } >+ >+ public static Test suite() { >+ Test suite = buildTestSuite(testClass()); >+ TESTS_COUNTERS.put(testClass().getName(), new Integer(suite.countTestCases())); >+ return suite; >+ } >+ >+ public static Class testClass() { >+ return EnclosingMethodAttributeTest.class; >+ } >+ >+ public void test001() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ "public static void main(String[] args) throws Exception {\n" + >+ " class MyLocal$A {\n" + >+ " class Member {\n" + >+ " }\n" + >+ " };\n" + >+ " System.out.print(MyLocal$A.Member.class.getEnclosingMethod() != null);\n" + >+ " System.out.print(MyLocal$A.Member.class.getEnclosingConstructor() != null);\n" + >+ "\n" + >+ " System.out.print(MyLocal$A.class.getEnclosingMethod()!= null);\n" + >+ " System.out.print(MyLocal$A.class.getEnclosingConstructor() != null); \n" + >+ " \n" + >+ " System.out.print(X.class.getEnclosingMethod() != null);\n" + >+ " System.out.print(X.class.getEnclosingConstructor() != null); \n" + >+ "}\n" + >+ "public Object foo() {\n" + >+ " return new Object() {};\n" + >+ "}\n" + >+ "}" >+ }, >+ "falsefalsetruefalsefalsefalse"); >+ >+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler(); >+ String actualOutput = null; >+ try { >+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator +"X$1.class")); >+ actualOutput = >+ disassembler.disassemble( >+ classFileBytes, >+ "\n", >+ ClassFileBytesDisassembler.DETAILED); >+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) { >+ assertTrue("ClassFormatException", false); >+ } catch (IOException e) { >+ assertTrue("IOException", false); >+ } >+ >+ String expectedOutput = " Enclosing Method: #23 #25 X.foo()Ljava/lang/Object;\n"; >+ >+ int index = actualOutput.indexOf(expectedOutput); >+ if (index == -1 || expectedOutput.length() == 0) { >+ System.out.println(Util.displayString(actualOutput, 2)); >+ } >+ if (index == -1) { >+ assertEquals("Wrong contents", expectedOutput, actualOutput); >+ } >+ } >+}
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 104738
:
25162
| 25243