From: aclement Date: Wed, 4 Feb 2009 20:30:36 +0000 (+0000) Subject: 257277: Incorrect generated Source Signature for FieldDeclarations X-Git-Tag: pre268419~134 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=55dacf6126a9ffa4b67b40da90d1200525bce779;p=aspectj.git 257277: Incorrect generated Source Signature for FieldDeclarations --- diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java index 5fca46ebf..a25c6f91d 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java @@ -327,17 +327,47 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("ensure getSourceSignature correct with static field"); IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "MY_COMPARATOR"); - String expected = "static final Comparator MY_COMPARATOR;\n"; + String expected = "static final Comparator MY_COMPARATOR = null;\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "aString"); + expected = "static final String aString = \"Constant String\";\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "bString"); + expected = "static final String bString = aString;\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "cString"); + expected = "static final String cString = (aString + bString);\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "dString"); + expected = "static final String dString = ((aString + \" and \") + bString);\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "eString"); + expected = "static final String eString = \"Hello World\";\n"; assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe .getSourceSignature()); ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "aList"); - expected = "public List aList;\n"; + expected = "public List aList = null;\n"; assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe .getSourceSignature()); ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "bList"); - expected = "public List bList;\n"; + expected = "public List bList = null;\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "cList"); + expected = "public List cList = null;\n"; assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe .getSourceSignature()); }