From 5c0585e80dfc83a69652b657ecb395e482657403 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 24 Nov 2010 19:37:45 +0000 Subject: [PATCH] format --- .../systemtest/ajc1610/NewFeatures.java | 223 +++++++++--------- 1 file changed, 113 insertions(+), 110 deletions(-) diff --git a/tests/src/org/aspectj/systemtest/ajc1610/NewFeatures.java b/tests/src/org/aspectj/systemtest/ajc1610/NewFeatures.java index dbb5faa7f..5bb559f80 100644 --- a/tests/src/org/aspectj/systemtest/ajc1610/NewFeatures.java +++ b/tests/src/org/aspectj/systemtest/ajc1610/NewFeatures.java @@ -22,126 +22,130 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase { - public void testMakeSJPOptimizationLDCNo() { - this. - runTest("makeSJP optimization - LDC - No"); - try { - JavaClass myClass = getMyClass("B"); - Method preClinitMethod = getPreClinitMethod(myClass); - NewFeatures.assertTrue("For 1.4 it must use classForName", preClinitMethod.getCode().toString().contains("forName")); - } catch (Exception e) { - NewFeatures.fail(e.toString()); + public void testMakeSJPOptimizationLDCNo() { + this.runTest("makeSJP optimization - LDC - No"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures.assertTrue("For 1.4 it must use classForName", preClinitMethod.getCode().toString().contains("forName")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } } - } - - - - public void testMakeSJPOptimizationCollapsedSJPYes14() { - this. - runTest("makeSJP optimization - Collapsed SJP - Yes 1.4"); - try { - JavaClass myClass = getMyClass("B"); - } catch (Exception e) { - NewFeatures.fail(e.toString()); + + public void testMakeSJPOptimizationCollapsedSJPYes14() { + this.runTest("makeSJP optimization - Collapsed SJP - Yes 1.4"); + try { + JavaClass myClass = getMyClass("B"); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } } - } - - public void testMakeSJPOptimizationLDCYes() { - this. - runTest("makeSJP optimization - LDC - Yes"); - try { - JavaClass myClass = getMyClass("B"); - Method preClinitMethod = getPreClinitMethod(myClass); - NewFeatures.assertTrue("For 1.5 it must not use classForName", !preClinitMethod.getCode().toString().contains("forName")); - } catch (Exception e) { - NewFeatures.fail(e.toString()); + + public void testMakeSJPOptimizationLDCYes() { + this.runTest("makeSJP optimization - LDC - Yes"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures.assertTrue("For 1.5 it must not use classForName", !preClinitMethod.getCode().toString() + .contains("forName")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } } - } - - public void testMakeSJPOptimizationCollapsedSJPYes() { - this. - runTest("makeSJP optimization - Collapsed SJP - Yes"); - try { - JavaClass myClass = getMyClass("B"); - Method preClinitMethod = getPreClinitMethod(myClass); - NewFeatures.assertTrue("MakedMethodSig MUST not be present", !preClinitMethod.getCode().toString().contains("makeMethodSig")); - } catch (Exception e) { - NewFeatures.fail(e.toString()); + + public void testMakeSJPOptimizationCollapsedSJPYes() { + this.runTest("makeSJP optimization - Collapsed SJP - Yes"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures.assertTrue("MakedMethodSig MUST not be present", + !preClinitMethod.getCode().toString().contains("makeMethodSig")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } } - } - - public void testMakeSJPOptimizationCollapsedSJPNo() { - this. - runTest("makeSJP optimization - Collapsed SJP - No"); - try { - JavaClass myClass = getMyClass("B"); - Method preClinitMethod = getPreClinitMethod(myClass); - NewFeatures.assertTrue("MakedMethodSig required", preClinitMethod.getCode().toString().contains("makeMethodSig")); - } catch (Exception e) { - NewFeatures.fail(e.toString()); + + public void testMakeSJPOptimizationCollapsedSJPNo() { + this.runTest("makeSJP optimization - Collapsed SJP - No"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures.assertTrue("MakedMethodSig required", preClinitMethod.getCode().toString().contains("makeMethodSig")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } } - } - - - public void testMakeSJPOptimizationNoExceptionNo() { - this. - runTest("makeSJP optimization - No Exception - No"); - try { - JavaClass myClass = getMyClass("B"); - Method preClinitMethod = getPreClinitMethod(myClass); - NewFeatures.assertTrue("MakedMethodSig required", preClinitMethod.getCode().toString().contains("invokevirtual org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature;")); - } catch (Exception e) { - NewFeatures.fail(e.toString()); + + public void testMakeSJPOptimizationNoExceptionNo() { + this.runTest("makeSJP optimization - No Exception - No"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures + .assertTrue( + "MakedMethodSig required", + preClinitMethod + .getCode() + .toString() + .contains( + "invokevirtual org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature;")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } } - } - - public void testMakeSJPOptimizationNoExceptionYes() { - this. - runTest("makeSJP optimization - No Exception - Yes"); - try { - JavaClass myClass = getMyClass("B"); - Method preClinitMethod = getPreClinitMethod(myClass); - NewFeatures.assertTrue("MakedMethodSig required", preClinitMethod.getCode().toString().contains("org.aspectj.runtime.reflect.Factory.makeSJP (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Lorg/aspectj/lang/JoinPoint$StaticPart;")); - } catch (Exception e) { - NewFeatures.fail(e.toString()); + + public void testMakeSJPOptimizationNoExceptionYes() { + this.runTest("makeSJP optimization - No Exception - Yes"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures + .assertTrue( + "MakedMethodSig required", + preClinitMethod + .getCode() + .toString() + .contains( + "org.aspectj.runtime.reflect.Factory.makeSJP (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Lorg/aspectj/lang/JoinPoint$StaticPart;")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } } - } - - public void testMakeSJPOptimizationRemoveExtraColon() { - this. - runTest("makeSJP optimization - Remove Colon"); - try { - JavaClass myClass = getMyClass("B"); - Method preClinitMethod = getPreClinitMethod(myClass); - System.out.println(preClinitMethod.getCode().toString()); - NewFeatures.assertTrue("MakedMethodSig required", preClinitMethod.getCode().toString().contains("50: ldc \"java.lang.String\" (108)")); - } catch (Exception e) { - NewFeatures.fail(e.toString()); + + public void testMakeSJPOptimizationRemoveExtraColon() { + this.runTest("makeSJP optimization - Remove Colon"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + System.out.println(preClinitMethod.getCode().toString()); + NewFeatures.assertTrue("MakedMethodSig required", + preClinitMethod.getCode().toString().contains("50: ldc \"java.lang.String\" (108)")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } } - } - - - ///////////////////////////////////////// - - private Method getPreClinitMethod(JavaClass myClass){ - Method lm[] =myClass.getMethods(); - for(int i=0; i< lm.length; i++ ){ - if(lm[i].getName().equals("ajc$preClinit")){ + + // /////////////////////////////////////// + + private Method getPreClinitMethod(JavaClass myClass) { + Method lm[] = myClass.getMethods(); + for (int i = 0; i < lm.length; i++) { + if (lm[i].getName().equals("ajc$preClinit")) { return lm[i]; - } + } } return null; -} + } - public static Test suite() { - return XMLBasedAjcTestCase.loadSuite(NewFeatures.class); - } + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(NewFeatures.class); + } - private JavaClass getMyClass(String className) throws ClassNotFoundException{ + private JavaClass getMyClass(String className) throws ClassNotFoundException { return getClassFrom(ajc.getSandboxDirectory(), className); } - - + public SyntheticRepository createRepos(File cpentry) { ClassPath cp = new ClassPath(cpentry + File.pathSeparator + System.getProperty("java.class.path")); return SyntheticRepository.getInstance(cp); @@ -151,10 +155,9 @@ public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase { SyntheticRepository repos = createRepos(where); return repos.loadClass(clazzname); } - - protected File getSpecFile() { - return new File("../tests/src/org/aspectj/systemtest/ajc1610/newfeatures-tests.xml"); - } - + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc1610/newfeatures-tests.xml"); + } + } \ No newline at end of file -- 2.39.5