]> source.dussan.org Git - aspectj.git/commitdiff
Fix for 53999
authoraclement <aclement>
Tue, 27 Jul 2004 10:34:41 +0000 (10:34 +0000)
committeraclement <aclement>
Tue, 27 Jul 2004 10:34:41 +0000 (10:34 +0000)
   "can't bind type" message has $ for . in type name for declare soft

tests/ajcTests.xml
tests/bugs/Cosmetic.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java

index 08d856f20b879dad05137399336aa57161c28c0c..a74b3d915bd21959c85ab76b06de28abf5b93f2c 100644 (file)
         </compile>
     </ajc-test>
  
+    <ajc-test dir="bugs"
+               pr="53999" title="'can't bind type' message has $ for . in type name for declare soft">
+        <compile files="Cosmetic.java">
+        <message kind="error" line="9" text="can't bind type name 'unknown.Error'"/>
+        </compile>
+    </ajc-test> 
 </suite>
diff --git a/tests/bugs/Cosmetic.java b/tests/bugs/Cosmetic.java
new file mode 100644 (file)
index 0000000..bc87430
--- /dev/null
@@ -0,0 +1,11 @@
+ class Test {
+       public static void main(String[] args) {
+               test();
+       }
+       static void test() {
+               throw new Error("hello");
+       }
+       static aspect A {
+               declare soft : unknown.Error : call(void test()); // CE  should be a message saying cant bind type 'unknown.Error' and not 'unknown$Error'
+       }
+}
\ No newline at end of file
index f710c5aaacf10e066db6695b624f1303381bc765..01324e36b8412aa011bb8b9ff396d3d5e88e958e 100644 (file)
@@ -333,6 +333,7 @@ public class WildTypePattern extends TypePattern {
                }
                
                String cleanName = maybeGetCleanName();
+               String originalName = cleanName;
                if (cleanName != null) {
                        TypeX type;
                        
@@ -347,14 +348,14 @@ public class WildTypePattern extends TypePattern {
                                if (requireExactType) {
                                        if (!allowBinding) {
                                                scope.getWorld().getMessageHandler().handleMessage(
-                                                       MessageUtil.error("can't bind type name '" + cleanName + "'",
+                                                       MessageUtil.error("can't bind type name '" + originalName + "'",
                                                                                        getSourceLocation()));
                                        } else if (scope.getWorld().getLint().invalidAbsoluteTypeName.isEnabled()) {
-                                               scope.getWorld().getLint().invalidAbsoluteTypeName.signal(cleanName, getSourceLocation());
+                                               scope.getWorld().getLint().invalidAbsoluteTypeName.signal(originalName, getSourceLocation());
                                        }
                                        return NO;
                                } else if (scope.getWorld().getLint().invalidAbsoluteTypeName.isEnabled()) {
-                                       scope.getWorld().getLint().invalidAbsoluteTypeName.signal(cleanName, getSourceLocation());
+                                       scope.getWorld().getLint().invalidAbsoluteTypeName.signal(originalName, getSourceLocation());
                                }
                        } else {
                                if (dim != 0) type = TypeX.makeArray(type, dim);