Community
Participate
Working Groups
1.1.0 and 1.1 cvs head (9/8) compiler output: C:\eclipse\workspace\atrack>ajc -d debug @narrow.lst C:\eclipse\workspace\atrack\src\org\atrack\model\error\impl\Softener.java:13 no match for this type name: NoSoftener [Xlint:invalidAbsoluteTypeName] 1 warning This bug affects 1.0.6 with the -Xlint option too... --- import java.lang.reflect.Constructor; /* * Created on Sep 8, 2003 * * Copyright (c) 2003 New Aspects of Security. All Rights Reserved. */ /** * @author Ron Bodkin * */ public class NoSoftener { public void foo(Class clazz) { Class[] keyArgType = {}; Constructor ctor = clazz.getConstructor(keyArgType); } } /* * Created on Sep 8, 2003 * * Copyright (c) 2003 New Aspects of Security. All Rights Reserved. */ package org.atrack.model.error.impl; /** * @author Ron Bodkin * */ public aspect Softener { pointcut callsThrowingChecked(): call(* *(..) /*throws Exception+*/) && within(NoSoftener); declare soft: Exception+: callsThrowingChecked(); }
Contributing the source per CPL: /** * @author Ron Bodkin */ public class NoSoftener { public void foo(Class clazz) { Class[] keyArgType = {}; Constructor ctor = clazz.getConstructor(keyArgType); } } package org.atrack.model.error.impl; /** * @author Ron Bodkin */ public aspect Softener { pointcut callsThrowingChecked(): call(* *(..) /*throws Exception+*/) && within(NoSoftener); declare soft: Exception+: callsThrowingChecked(); }
This is not a bug, but the correct implementation of type name resolution according to the JLS and implemented in all compliant Java compilers (first implemented in jdk 1.4.0). There is no way to refer to types in the default package from a named package. Go ahead and try this without any aspects using the jdk1.4 or later compiler and you'll see the same behavior.