瀏覽代碼

Moved all weaver messages into weaver-messages.properties.

Includes fixes for Bugzilla Bug 30439
 	spurious "circular dependency" error
tags/for_ajdt1_1_12
acolyer 20 年之前
父節點
當前提交
4feb835a53
共有 27 個檔案被更改,包括 404 行新增125 行删除
  1. 11
    13
      weaver/src/org/aspectj/weaver/Advice.java
  2. 9
    7
      weaver/src/org/aspectj/weaver/Lint.java
  3. 3
    2
      weaver/src/org/aspectj/weaver/NewConstructorTypeMunger.java
  4. 22
    30
      weaver/src/org/aspectj/weaver/ResolvedTypeX.java
  5. 5
    4
      weaver/src/org/aspectj/weaver/Shadow.java
  6. 112
    0
      weaver/src/org/aspectj/weaver/WeaverMessages.java
  7. 2
    2
      weaver/src/org/aspectj/weaver/WeaverStateInfo.java
  8. 2
    1
      weaver/src/org/aspectj/weaver/World.java
  9. 2
    1
      weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
  10. 15
    10
      weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
  11. 4
    3
      weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
  12. 2
    3
      weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
  13. 6
    2
      weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
  14. 3
    2
      weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java
  15. 3
    2
      weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java
  16. 12
    9
      weaver/src/org/aspectj/weaver/patterns/DeclareParents.java
  17. 9
    8
      weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java
  18. 2
    1
      weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java
  19. 12
    11
      weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
  20. 3
    4
      weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java
  21. 6
    5
      weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java
  22. 3
    2
      weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
  23. 3
    1
      weaver/src/org/aspectj/weaver/patterns/TypePattern.java
  24. 3
    2
      weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java
  25. 99
    0
      weaver/src/org/aspectj/weaver/weaver-messages.properties
  26. 1
    0
      weaver/testsrc/org/aspectj/weaver/BcweaverTests.java
  27. 50
    0
      weaver/testsrc/org/aspectj/weaver/WeaverMessagesTestCase.java

+ 11
- 13
weaver/src/org/aspectj/weaver/Advice.java 查看文件

@@ -92,8 +92,8 @@ public abstract class Advice extends ShadowMunger {
if (shadow.getKind() == Shadow.ExceptionHandler) {
if (kind.isAfter() || kind == AdviceKind.Around) {
world.showMessage(IMessage.WARNING,
"Only before advice is supported on handler join points (compiler limitation)",
getSourceLocation(), shadow.getSourceLocation());
WeaverMessages.format(WeaverMessages.ONLY_BEFORE_ON_HANDLER),
getSourceLocation(), shadow.getSourceLocation());
return false;
}
}
@@ -108,29 +108,27 @@ public abstract class Advice extends ShadowMunger {
} else if (kind == AdviceKind.Around) {
if (shadow.getKind() == Shadow.PreInitialization) {
world.showMessage(IMessage.ERROR,
"around on pre-initialization not supported (compiler limitation)",
getSourceLocation(), shadow.getSourceLocation());
WeaverMessages.format(WeaverMessages.AROUND_ON_PREINIT),
getSourceLocation(), shadow.getSourceLocation());
return false;
} else if (shadow.getKind() == Shadow.Initialization) {
world.showMessage(IMessage.ERROR,
"around on initialization not supported (compiler limitation)",
getSourceLocation(), shadow.getSourceLocation());
WeaverMessages.format(WeaverMessages.AROUND_ON_INIT),
getSourceLocation(), shadow.getSourceLocation());
return false;
} else if (shadow.getKind() == Shadow.StaticInitialization &&
shadow.getEnclosingType().isInterface(world))
{
world.showMessage(IMessage.ERROR,
"around on staticinitialization of interface \'" +
shadow.getEnclosingType().getName() +
"\' not supported (compiler limitation)",
getSourceLocation(), shadow.getSourceLocation());
WeaverMessages.format(WeaverMessages.AROUND_ON_INTERFACE_STATICINIT,shadow.getEnclosingType().getName()),
getSourceLocation(), shadow.getSourceLocation());
return false;
} else {
//System.err.println(getSignature().getReturnType() + " from " + shadow.getReturnType());
if (getSignature().getReturnType() == ResolvedTypeX.VOID) {
if (shadow.getReturnType() != ResolvedTypeX.VOID) {
world.showMessage(IMessage.ERROR,
"applying to join point that doesn't return void: " + shadow,
WeaverMessages.format(WeaverMessages.NON_VOID_RETURN,shadow),
getSourceLocation(), shadow.getSourceLocation());
return false;
}
@@ -138,8 +136,8 @@ public abstract class Advice extends ShadowMunger {
return true;
} else if(!shadow.getReturnType().isAssignableFrom(getSignature().getReturnType(), world)) {
//System.err.println(this + ", " + sourceContext + ", " + start);
world.showMessage(IMessage.ERROR,
"incompatible return type applying to " + shadow,
world.showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.INCOMPATIBLE_RETURN_TYPE,shadow),
getSourceLocation(), shadow.getSourceLocation());
return false;
}

+ 9
- 7
weaver/src/org/aspectj/weaver/Lint.java 查看文件

@@ -83,22 +83,23 @@ public class Lint {
InputStream s = new FileInputStream(file);
setFromProperties(s);
} catch (IOException ioe) {
MessageUtil.error(world.getMessageHandler(), "problem loading Xlint properties file: " +
file.getPath() + ", " + ioe.getMessage());
MessageUtil.error(world.getMessageHandler(),
WeaverMessages.format(WeaverMessages.XLINT_LOAD_ERROR,file.getPath(),ioe.getMessage()));
}
}

public void loadDefaultProperties() {
InputStream s = getClass().getResourceAsStream("XlintDefault.properties");
if (s == null) {
MessageUtil.warn(world.getMessageHandler(), "couldn't load XlintDefault.properties");
MessageUtil.warn(world.getMessageHandler(),
WeaverMessages.format(WeaverMessages.XLINTDEFAULT_LOAD_ERROR));
return;
}
try {
setFromProperties(s);
} catch (IOException ioe) {
MessageUtil.error(world.getMessageHandler(), "problem loading XlintDefault.properties, " +
ioe.getMessage());
MessageUtil.error(world.getMessageHandler(),
WeaverMessages.format(WeaverMessages.XLINTDEFAULT_LOAD_PROBLEM,ioe.getMessage()));
}

}
@@ -116,7 +117,8 @@ public class Lint {
Map.Entry entry = (Map.Entry)i.next();
Kind kind = (Kind)kinds.get(entry.getKey());
if (kind == null) {
MessageUtil.error(world.getMessageHandler(), "invalid Xlint key: " + entry.getKey());
MessageUtil.error(world.getMessageHandler(),
WeaverMessages.format(WeaverMessages.XLINT_KEY_ERROR,entry.getKey()));
} else {
kind.setKind(getMessageKind((String)entry.getValue()));
}
@@ -129,7 +131,7 @@ public class Lint {
else if (v.equals("error")) return IMessage.ERROR;
MessageUtil.error(world.getMessageHandler(),
"invalid Xlint message kind (must be one of ignore, warning, error): " + v);
WeaverMessages.format(WeaverMessages.XLINT_VALUE_ERROR,v));
return null;
}

+ 3
- 2
weaver/src/org/aspectj/weaver/NewConstructorTypeMunger.java 查看文件

@@ -79,8 +79,9 @@ public class NewConstructorTypeMunger extends ResolvedTypeMunger {
public void check(World world) {
if (getSignature().getDeclaringType().isAspect(world)) {
world.showMessage(IMessage.ERROR, "can't declare constructor on an aspect",
getSignature().getSourceLocation(), null);
world.showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.ITD_CONS_ON_ASPECT),
getSignature().getSourceLocation(), null);
}
}


+ 22
- 30
weaver/src/org/aspectj/weaver/ResolvedTypeX.java 查看文件

@@ -1135,9 +1135,9 @@ public abstract class ResolvedTypeX extends TypeX {
} else {
//XXX dual errors possible if (this instanceof BcelObjectType) return false; //XXX ignores separate comp
getWorld().getMessageHandler().handleMessage(
MessageUtil.error("inter-type declaration from " + munger.getAspectType().getName() +
" conflicts with existing member: " + existingMember,
munger.getSourceLocation())
MessageUtil.error(WeaverMessages.format(WeaverMessages.ITD_MEMBER_CONFLICT,munger.getAspectType().getName(),
existingMember),
munger.getSourceLocation())
);
}
} else {
@@ -1153,9 +1153,8 @@ public abstract class ResolvedTypeX extends TypeX {
//System.err.println("check: " + child.getDeclaringType() + " overrides " + parent.getDeclaringType());
if (!parent.getReturnType().equals(child.getReturnType())) {
world.showMessage(IMessage.ERROR,
"can't override " + parent +
" with " + child + " return types don't match",
child.getSourceLocation(), parent.getSourceLocation());
WeaverMessages.format(WeaverMessages.ITD_RETURN_TYPE_MISMATCH,parent,child),
child.getSourceLocation(), parent.getSourceLocation());
return false;
}
if (parent.getKind() == Member.POINTCUT) {
@@ -1163,18 +1162,16 @@ public abstract class ResolvedTypeX extends TypeX {
TypeX[] cTypes = child.getParameterTypes();
if (!Arrays.equals(pTypes, cTypes)) {
world.showMessage(IMessage.ERROR,
"can't override " + parent +
" with " + child + " parameter types don't match",
child.getSourceLocation(), parent.getSourceLocation());
WeaverMessages.format(WeaverMessages.ITD_PARAM_TYPE_MISMATCH,parent,child),
child.getSourceLocation(), parent.getSourceLocation());
return false;
}
}
//System.err.println("check: " + child.getModifiers() + " more visible " + parent.getModifiers());
if (isMoreVisible(parent.getModifiers(), child.getModifiers())) {
world.showMessage(IMessage.ERROR,
"can't override " + parent +
" with " + child + " visibility is reduced",
child.getSourceLocation(), parent.getSourceLocation());
WeaverMessages.format(WeaverMessages.ITD_VISIBILITY_REDUCTION,parent,child),
child.getSourceLocation(), parent.getSourceLocation());
return false;
}
@@ -1193,19 +1190,20 @@ public abstract class ResolvedTypeX extends TypeX {
if (parentExceptions[j].isAssignableFrom(childExceptions[i])) continue outer;
}
world.showMessage(IMessage.ERROR, "overriden method doesn't throw "
+ childExceptions[i].getName(), child.getSourceLocation(), null);
world.showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.ITD_DOESNT_THROW,childExceptions[i].getName()),
child.getSourceLocation(), null);
return false;
}
if (parent.isStatic() && !child.isStatic()) {
world.showMessage(IMessage.ERROR,
child.toString()+" cannot override "+parent.toString()+"; overridden method is static",
child.getSourceLocation(),null);
WeaverMessages.format(WeaverMessages.ITD_OVERRIDDEN_STATIC,child,parent),
child.getSourceLocation(),null);
} else if (child.isStatic() && !parent.isStatic()) {
world.showMessage(IMessage.ERROR,
child.toString()+" cannot override "+parent.toString()+"; overriding method is static",
child.getSourceLocation(),null);
WeaverMessages.format(WeaverMessages.ITD_OVERIDDING_STATIC,child,parent),
child.getSourceLocation(),null);
}
return true;
@@ -1252,13 +1250,9 @@ public abstract class ResolvedTypeX extends TypeX {
//System.err.println("conflict at " + m2.getSourceLocation());
getWorld().showMessage(IMessage.ERROR,
"intertype declaration from "
+ m1.getAspectType().getName()
+ " conflicts with intertype declaration: "
+ m2.getSignature()
+ " from "
+ m2.getAspectType().getName(),
m2.getSourceLocation(), getSourceLocation());
WeaverMessages.format(WeaverMessages.ITD_CONFLICT,m1.getAspectType().getName(),
m2.getSignature(),m2.getAspectType().getName()),
m2.getSourceLocation(), getSourceLocation());
}
@@ -1308,9 +1302,8 @@ public abstract class ResolvedTypeX extends TypeX {
if (inherited.isAbstract()) {
if (!this.isAbstract()) {
getWorld().showMessage(IMessage.ERROR,
"inherited abstract " + inherited +
" is not made concrete in " + this.getName(),
inherited.getSourceLocation(), this.getSourceLocation());
WeaverMessages.format(WeaverMessages.POINCUT_NOT_CONCRETE,inherited,this.getName()),
inherited.getSourceLocation(), this.getSourceLocation());
}
}
}
@@ -1340,8 +1333,7 @@ public abstract class ResolvedTypeX extends TypeX {
} else {
getWorld().showMessage(
IMessage.ERROR,
"conflicting inherited pointcuts in "
+ this.getName() + toAdd.getSignature(),
WeaverMessages.format(WeaverMessages.CONFLICTING_INHERITED_POINTCUTS,this.getName() + toAdd.getSignature()),
existing.getSourceLocation(),
toAdd.getSourceLocation());
j.remove();

+ 5
- 4
weaver/src/org/aspectj/weaver/Shadow.java 查看文件

@@ -294,9 +294,9 @@ public abstract class Shadow {
}
if (!isDeclaredException(resolvedTypeX, getSignature())) {
getIWorld().showMessage(IMessage.ERROR, "can't throw checked exception \'" + resolvedTypeX +
"\' at this join point \'" + this +"\'", // from advice in \'" + munger. + "\'",
getSourceLocation(), munger.getSourceLocation());
getIWorld().showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.CANT_THROW_CHECKED,resolvedTypeX,this), // from advice in \'" + munger. + "\'",
getSourceLocation(), munger.getSourceLocation());
}
return true;
@@ -332,7 +332,8 @@ public abstract class Shadow {
for (Iterator i = mungers.iterator(); i.hasNext(); ) {
ShadowMunger m = (ShadowMunger)i.next();
getIWorld().getMessageHandler().handleMessage(
MessageUtil.error("circular advice dependency at " + this, m.getSourceLocation()));
MessageUtil.error(
WeaverMessages.format(WeaverMessages.CIRCULAR_DEPENDENCY,this), m.getSourceLocation()));
}
}
mungers = sorted;

+ 112
- 0
weaver/src/org/aspectj/weaver/WeaverMessages.java 查看文件

@@ -0,0 +1,112 @@
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.aspectj.weaver;

import java.text.MessageFormat;
import java.util.ResourceBundle;


public class WeaverMessages {
private static ResourceBundle bundle = ResourceBundle.getBundle("org.aspectj.weaver.weaver-messages");

public static final String ARGS_IN_DECLARE = "argsInDeclare";
public static final String CFLOW_IN_DECLARE = "cflowInDeclare";
public static final String IF_IN_DECLARE = "ifInDeclare";
public static final String THIS_OR_TARGET_IN_DECLARE = "thisOrTargetInDeclare";
public static final String ABSTRACT_POINTCUT = "abstractPointcut";
public static final String POINCUT_NOT_CONCRETE = "abstractPointcutNotMadeConcrete";
public static final String CONFLICTING_INHERITED_POINTCUTS = "conflictingInheritedPointcuts";
public static final String CIRCULAR_POINTCUT = "circularPointcutDeclaration";
public static final String CANT_FIND_POINTCUT = "cantFindPointcut";
public static final String EXACT_TYPE_PATTERN_REQD = "exactTypePatternRequired";
public static final String CANT_BIND_TYPE = "cantBindType";
public static final String WILDCARD_NOT_ALLOWED = "wildcardTypePatternNotAllowed";
public static final String DECP_OBJECT = "decpObject";
public static final String CANT_EXTEND_SELF="cantExtendSelf";
public static final String INTERFACE_CANT_EXTEND_CLASS="interfaceExtendClass";
public static final String DECP_HIERARCHY_ERROR = "decpHierarchy";
public static final String MULTIPLE_MATCHES_IN_PRECEDENCE = "multipleMatchesInPrecedence";
public static final String TWO_STARS_IN_PRECEDENCE = "circularityInPrecedenceStar";
public static final String CLASSES_IN_PRECEDENCE = "nonAspectTypesInPrecedence";
public static final String TWO_PATTERN_MATCHES_IN_PRECEDENCE = "circularityInPrecedenceTwo";
public static final String NOT_THROWABLE = "notThrowable";
public static final String ITD_CONS_ON_ASPECT = "itdConsOnAspect";
public static final String ITD_RETURN_TYPE_MISMATCH = "returnTypeMismatch";
public static final String ITD_PARAM_TYPE_MISMATCH = "paramTypeMismatch";
public static final String ITD_VISIBILITY_REDUCTION = "visibilityReduction";
public static final String ITD_DOESNT_THROW = "doesntThrow";
public static final String ITD_OVERRIDDEN_STATIC = "overriddenStatic";
public static final String ITD_OVERIDDING_STATIC = "overridingStatic";
public static final String ITD_CONFLICT = "itdConflict";
public static final String ITD_MEMBER_CONFLICT = "itdMemberConflict";
public static final String NON_VOID_RETURN = "nonVoidReturn";
public static final String INCOMPATIBLE_RETURN_TYPE="incompatibleReturnType";
public static final String CANT_THROW_CHECKED = "cantThrowChecked";
public static final String CIRCULAR_DEPENDENCY = "circularDependency";
public static final String MISSING_PER_CLAUSE = "missingPerClause";
public static final String WRONG_PER_CLAUSE = "wrongPerClause";
public static final String ALREADY_WOVEN = "alreadyWoven";
public static final String REWEAVABLE_MODE = "reweavableMode";
public static final String PROCESSING_REWEAVABLE = "processingReweavable";
public static final String MISSING_REWEAVABLE_TYPE = "missingReweavableType";
public static final String VERIFIED_REWEAVABLE_TYPE = "verifiedReweavableType";
public static final String ASPECT_NEEDED = "aspectNeeded";
public static final String CANT_FIND_TYPE = "cantFindType";
public static final String DECP_BINARY_LIMITATION = "decpBinaryLimitation";
public static final String OVERWRITE_JSR45 = "overwriteJSR45";
public static final String IF_IN_PERCLAUSE = "ifInPerClause";
public static final String IF_LEXICALLY_IN_CFLOW = "ifLexicallyInCflow";
public static final String ONLY_BEFORE_ON_HANDLER = "onlyBeforeOnHandler";
public static final String AROUND_ON_PREINIT = "aroundOnPreInit";
public static final String AROUND_ON_INIT = "aroundOnInit";
public static final String AROUND_ON_INTERFACE_STATICINIT = "aroundOnInterfaceStaticInit";
public static final String PROBLEM_GENERATING_METHOD = "problemGeneratingMethod";
public static final String ZIPFILE_ENTRY_MISSING = "zipfileEntryMissing";
public static final String ZIPFILE_ENTRY_INVALID = "zipfileEntryInvalid";
public static final String DIRECTORY_ENTRY_MISSING = "directoryEntryMissing";
public static final String XLINT_LOAD_ERROR = "problemLoadingXLint";
public static final String XLINTDEFAULT_LOAD_ERROR = "unableToLoadXLintDefault";
public static final String XLINTDEFAULT_LOAD_PROBLEM = "errorLoadingXLintDefault";
public static final String XLINT_KEY_ERROR = "invalidXLintKey";
public static final String XLINT_VALUE_ERROR = "invalidXLintMessageKind";
public static String format(String key) {
return bundle.getString(key);
}
public static String format(String key, Object insert) {
return MessageFormat.format(bundle.getString(key),new Object[] {insert});
}

public static String format(String key, Object insert1, Object insert2) {
return MessageFormat.format(bundle.getString(key),new Object[] {insert1,insert2});
}

public static String format(String key, Object insert1, Object insert2, Object insert3) {
return MessageFormat.format(bundle.getString(key),new Object[] {insert1, insert2, insert3});
}

}

+ 2
- 2
weaver/src/org/aspectj/weaver/WeaverStateInfo.java 查看文件

@@ -162,8 +162,8 @@ public class WeaverStateInfo {
Entry entry = (Entry) i.next();
ResolvedTypeX aspectType = world.resolve(entry.aspectType, true);
if (aspectType == ResolvedTypeX.MISSING) {
world.showMessage(IMessage.ERROR, "aspect " + entry.aspectType +
" is needed when using type " + onType,
world.showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.ASPECT_NEEDED,entry.aspectType,onType),
onType.getSourceLocation(), null);
continue;
}

+ 2
- 1
weaver/src/org/aspectj/weaver/World.java 查看文件

@@ -82,7 +82,8 @@ public abstract class World {
ret = resolveObjectType(ty);
if (!allowMissing && ret == ResolvedTypeX.MISSING) {
//Thread.currentThread().dumpStack();
MessageUtil.error(messageHandler, "can't find type " + ty.getName());
MessageUtil.error(messageHandler,
WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE,ty.getName()));
// + " on classpath " + classPath);
}
}

+ 2
- 1
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java 查看文件

@@ -62,6 +62,7 @@ import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.WeaverStateInfo;
import org.aspectj.weaver.Shadow.Kind;
import org.aspectj.weaver.patterns.FastMatchInfo;
@@ -288,7 +289,7 @@ class BcelClassWeaver implements IClassWeaver {

if (clazz.isWoven() && !clazz.isReweavable()) {
world.showMessage(IMessage.ERROR,
"class \'" + clazz.getType().getName() + "\' is already woven and has not been built with -Xreweavable",
WeaverMessages.format(WeaverMessages.ALREADY_WOVEN,clazz.getType().getName()),
ty.getSourceLocation(), null);
return false;
}

+ 15
- 10
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java 查看文件

@@ -54,6 +54,7 @@ import org.aspectj.weaver.ResolvedTypeMunger;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.WeaverStateInfo;
import org.aspectj.weaver.patterns.DeclareParents;
import org.aspectj.weaver.patterns.FastMatchInfo;
@@ -574,7 +575,9 @@ public class BcelWeaver implements IWeaver {
public void prepareToProcessReweavableState() {
if (inReweavableMode)
world.showMessage(IMessage.INFO, "weaver operating in reweavable mode. Need to verify any required types exist.", null, null);
world.showMessage(IMessage.INFO,
WeaverMessages.format(WeaverMessages.REWEAVABLE_MODE),
null, null);
alreadyConfirmedReweavableState = new HashSet();
}
@@ -583,7 +586,9 @@ public class BcelWeaver implements IWeaver {
// If the class is marked reweavable, check any aspects around when it was built are in this world
WeaverStateInfo wsi = classType.getWeaverState();
if (wsi!=null && wsi.isReweavable()) { // Check all necessary types are around!
world.showMessage(IMessage.INFO,"processing reweavable type "+className+": "+classType.getSourceLocation().getSourceFile(),null,null);
world.showMessage(IMessage.INFO,
WeaverMessages.format(WeaverMessages.PROCESSING_REWEAVABLE,className,classType.getSourceLocation().getSourceFile()),
null,null);
Set aspectsPreviouslyInWorld = wsi.getAspectsAffectingType();
if (aspectsPreviouslyInWorld!=null) {
for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) {
@@ -592,13 +597,14 @@ public class BcelWeaver implements IWeaver {
ResolvedTypeX rtx = world.resolve(TypeX.forName(requiredTypeName),true);
boolean exists = rtx!=ResolvedTypeX.MISSING;
if (!exists) {
world.showMessage(IMessage.ERROR, "type " + requiredTypeName +
" is needed by reweavable type " + className,
classType.getSourceLocation(), null);
world.showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.MISSING_REWEAVABLE_TYPE,requiredTypeName,className),
classType.getSourceLocation(), null);
} else {
if (!world.getMessageHandler().isIgnoring(IMessage.INFO))
world.showMessage(IMessage.INFO,"successfully verified type "+requiredTypeName+
" exists. Originates from "+rtx.getSourceLocation().getSourceFile(),null,null);
world.showMessage(IMessage.INFO,
WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE,requiredTypeName,rtx.getSourceLocation().getSourceFile()),
null,null);
alreadyConfirmedReweavableState.add(requiredTypeName);
}
}
@@ -662,9 +668,8 @@ public class BcelWeaver implements IWeaver {
ResolvedTypeX newParent = (ResolvedTypeX)j.next();
if (newParent.isClass()) {
world.showMessage(IMessage.ERROR,
"can't use declare parents to change superclass of binary form \'" +
onType.getName() + "\' (implementation limitation)",
p.getSourceLocation(), null);
WeaverMessages.format(WeaverMessages.DECP_BINARY_LIMITATION,onType.getName()),
p.getSourceLocation(), null);
continue;
}

+ 4
- 3
weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java 查看文件

@@ -27,6 +27,7 @@ import java.util.zip.ZipFile;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;


public class ClassPathManager {
@@ -48,18 +49,18 @@ public class ClassPathManager {
String lc = name.toLowerCase();
if (lc.endsWith(".jar") || lc.endsWith(".zip")) {
if (!f.isFile()) {
MessageUtil.info(handler, "zipfile classpath entry does not exist: " + name);
MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_MISSING,name));
return;
}
try {
entries.add(new ZipFileEntry(f));
} catch (IOException ioe) {
MessageUtil.warn(handler, "zipfile classpath entry is invalid: " + name + "<" + ioe.getMessage() + ">");
MessageUtil.warn(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_INVALID,name,ioe.getMessage()));
return;
}
} else {
if (!f.isDirectory()) {
MessageUtil.info(handler, "directory classpath entry does not exist: " + name);
MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.DIRECTORY_ENTRY_MISSING,name));
return;
}
entries.add(new DirEntry(f));

+ 2
- 3
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java 查看文件

@@ -58,6 +58,7 @@ import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.WeaverStateInfo;
import org.aspectj.weaver.World;

@@ -398,9 +399,7 @@ public final class LazyClassGen {
if (hasSourceDebugExtensionAttribute(myGen)) {
world.showMessage(
IMessage.WARNING,
"overwriting JSR45 information for "
+ getFileName()
+ " (compiler limitation)",
WeaverMessages.format(WeaverMessages.OVERWRITE_JSR45,getFileName()),
null,
null);
}

+ 6
- 2
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java 查看文件

@@ -54,6 +54,7 @@ import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.WeaverMessages;


/**
@@ -324,8 +325,11 @@ public final class LazyMethodGen {
return gen.getMethod();
} catch (ClassGenException e) {
enclosingClass.getBcelObjectType().getResolvedTypeX().getWorld().showMessage(
IMessage.ERROR, "problem generating method " +
this.getClassName() + "." + this.getName() + ": " + e.getMessage(),
IMessage.ERROR,
WeaverMessages.format(WeaverMessages.PROBLEM_GENERATING_METHOD,
this.getClassName(),
this.getName(),
e.getMessage()),
this.getMemberView() == null ? null : this.getMemberView().getSourceLocation(), null);
throw e;
}

+ 3
- 2
weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java 查看文件

@@ -31,6 +31,7 @@ import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;

@@ -138,8 +139,8 @@ public class ArgsPointcut extends NameBindingPointcut {
if (isDeclare(bindings.getEnclosingAdvice())) {
// Enforce rule about which designators are supported in declare
inAspect.getWorld().showMessage(IMessage.ERROR,
"args() pointcut designator cannot be used in declare statement",
bindings.getEnclosingAdvice().getSourceLocation(), null);
WeaverMessages.format(WeaverMessages.ARGS_IN_DECLARE),
bindings.getEnclosingAdvice().getSourceLocation(), null);
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}
TypePatternList args = arguments.resolveReferences(bindings);

+ 3
- 2
weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java 查看文件

@@ -35,6 +35,7 @@ import org.aspectj.weaver.ResolvedPointcutDefinition;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
import org.aspectj.weaver.ast.Test;

@@ -131,8 +132,8 @@ public class CflowPointcut extends Pointcut {
if (isDeclare(bindings.getEnclosingAdvice())) {
// Enforce rule about which designators are supported in declare
inAspect.getWorld().showMessage(IMessage.ERROR,
"cflow"+(isBelow?"below":"")+"() pointcut designator cannot be used in declare statement",
bindings.getEnclosingAdvice().getSourceLocation(), null);
WeaverMessages.format(WeaverMessages.CFLOW_IN_DECLARE,isBelow?"below":""),
bindings.getEnclosingAdvice().getSourceLocation(), null);
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}
//make this remap from formal positions to arrayIndices

+ 12
- 9
weaver/src/org/aspectj/weaver/patterns/DeclareParents.java 查看文件

@@ -24,6 +24,7 @@ import org.aspectj.bridge.IMessage;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;

public class DeclareParents extends Declare {
@@ -115,8 +116,9 @@ public class DeclareParents extends Declare {
ResolvedTypeX parentType = iType.resolve(world);
if (targetType.equals(world.resolve(TypeX.OBJECT))) {
world.showMessage(IMessage.ERROR, "can't change the parents of java.lang.Object",
this.getSourceLocation(), null);
world.showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.DECP_OBJECT),
this.getSourceLocation(), null);
return null;
}
@@ -124,7 +126,8 @@ public class DeclareParents extends Declare {
if (targetType.isAssignableFrom(parentType)) {
world.showMessage(IMessage.ERROR,
"type \'" + targetType.getName() + "\'can not extend itself", this.getSourceLocation(), null
WeaverMessages.format(WeaverMessages.CANT_EXTEND_SELF,targetType.getName()),
this.getSourceLocation(), null
);
return null;
}
@@ -132,8 +135,8 @@ public class DeclareParents extends Declare {
if (parentType.isClass()) {
if (targetType.isInterface()) {
world.showMessage(IMessage.ERROR,
"interface can not extend a class",
this.getSourceLocation(), null
WeaverMessages.format(WeaverMessages.INTERFACE_CANT_EXTEND_CLASS),
this.getSourceLocation(), null
);
return null;
// how to handle xcutting errors???
@@ -141,10 +144,10 @@ public class DeclareParents extends Declare {
if (!targetType.getSuperclass().isAssignableFrom(parentType)) {
world.showMessage(IMessage.ERROR,
"can only insert a class into hierarchy, but "
+ iType.getName() + " is not a subtype of " +
targetType.getSuperclass().getName(),
this.getSourceLocation(), null
WeaverMessages.format(WeaverMessages.DECP_HIERARCHY_ERROR,
iType.getName(),
targetType.getSuperclass().getName()),
this.getSourceLocation(), null
);
return null;
} else {

+ 9
- 8
weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java 查看文件

@@ -21,6 +21,7 @@ import java.util.List;
import org.aspectj.bridge.IMessage;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.WeaverMessages;

public class DeclarePrecedence extends Declare {
private TypePatternList patterns;
@@ -74,8 +75,8 @@ public class DeclarePrecedence extends Declare {
if (pi.isStar()) {
if (seenStar) {
scope.getWorld().showMessage(IMessage.ERROR,
"circularity in declare precedence, '*' occurs more than once",
pi.getSourceLocation(), null);
WeaverMessages.format(WeaverMessages.TWO_STARS_IN_PRECEDENCE),
pi.getSourceLocation(), null);
}
seenStar = true;
continue;
@@ -86,8 +87,8 @@ public class DeclarePrecedence extends Declare {
// Cannot do a dec prec specifying a non-aspect types unless suffixed with a '+'
if (!exactType.isAspect() && !pi.isIncludeSubtypes()) {
scope.getWorld().showMessage(IMessage.ERROR,
"Non-aspect types can only be specified in a declare precedence statement when subtypes are included. Non-aspect type is : "+exactType.getName(),
pi.getSourceLocation(),null);
WeaverMessages.format(WeaverMessages.CLASSES_IN_PRECEDENCE,exactType.getName()),
pi.getSourceLocation(),null);
}
for (int j=0; j < patterns.size(); j++) {
@@ -96,8 +97,8 @@ public class DeclarePrecedence extends Declare {
if (pj.isStar()) continue;
if (pj.matchesStatically(exactType)) {
scope.getWorld().showMessage(IMessage.ERROR,
"circularity in declare precedence, '" + exactType.getName() +
"' matches two patterns", pi.getSourceLocation(), pj.getSourceLocation());
WeaverMessages.format(WeaverMessages.TWO_PATTERN_MATCHES_IN_PRECEDENCE,exactType.getName()),
pi.getSourceLocation(), pj.getSourceLocation());
}
}
}
@@ -116,8 +117,8 @@ public class DeclarePrecedence extends Declare {
starMatch = i;
} else if (p.matchesStatically(a)) {
if (knownMatch != -1) {
a.getWorld().showMessage(IMessage.ERROR, "multiple matches for " + a +
", matches both " + patterns.get(knownMatch) + " and " + p,
a.getWorld().showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.MULTIPLE_MATCHES_IN_PRECEDENCE,a,patterns.get(knownMatch),p),
patterns.get(knownMatch).getSourceLocation(), p.getSourceLocation());
return -1;
} else {

+ 2
- 1
weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java 查看文件

@@ -21,6 +21,7 @@ import org.aspectj.bridge.IMessage;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;

public class DeclareSoft extends Declare {
private TypePattern exception;
@@ -87,7 +88,7 @@ public class DeclareSoft extends Declare {
if (excType != ResolvedTypeX.MISSING) {
if (!scope.getWorld().resolve(TypeX.THROWABLE).isAssignableFrom(excType)) {
scope.getWorld().showMessage(IMessage.ERROR,
excType.getName() + " is not a subtype of Throwable",
WeaverMessages.format(WeaverMessages.NOT_THROWABLE,excType.getName()),
exception.getSourceLocation(), null);
pointcut = Pointcut.makeMatchesNothing(Pointcut.RESOLVED);
return;

+ 12
- 11
weaver/src/org/aspectj/weaver/patterns/IfPointcut.java 查看文件

@@ -30,6 +30,7 @@ import org.aspectj.weaver.ResolvedPointcutDefinition;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Expr;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
@@ -153,9 +154,9 @@ public class IfPointcut extends Pointcut {
if (isDeclare(bindings.getEnclosingAdvice())) {
// Enforce rule about which designators are supported in declare
inAspect.getWorld().showMessage(IMessage.ERROR,
"if() pointcut designator cannot be used in declare statement",
bindings.getEnclosingAdvice().getSourceLocation(),
null);
WeaverMessages.format(WeaverMessages.IF_IN_DECLARE),
bindings.getEnclosingAdvice().getSourceLocation(),
null);
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}
@@ -174,8 +175,8 @@ public class IfPointcut extends Pointcut {
// Assumption: if() is in a per clause if we say we are directly in advice
// but we have no enclosing advice.
inAspect.getWorld().showMessage(IMessage.ERROR,
"if() pointcut designator cannot be used directly in a per clause (compiler limitation). Create a named pointcut containing the if() and refer to it",
this.getSourceLocation(),null);
WeaverMessages.format(WeaverMessages.IF_IN_PERCLAUSE),
this.getSourceLocation(),null);
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}
@@ -191,8 +192,8 @@ public class IfPointcut extends Pointcut {
ResolvedPointcutDefinition def = bindings.peekEnclosingDefinitition();
if (def == CflowPointcut.CFLOW_MARKER) {
inAspect.getWorld().showMessage(IMessage.ERROR,
"if not supported lexically within cflow (compiler limitation)",
getSourceLocation(), null);
WeaverMessages.format(WeaverMessages.IF_LEXICALLY_IN_CFLOW),
getSourceLocation(), null);
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}
ret.baseArgsCount = def.getParameterTypes().length;
@@ -250,7 +251,7 @@ public class IfPointcut extends Pointcut {
if (isDeclare(bindings.getEnclosingAdvice())) {
// Enforce rule about which designators are supported in declare
inAspect.getWorld().showMessage(IMessage.ERROR,
"if() pointcut designator cannot be used in declare statement",
WeaverMessages.format(WeaverMessages.IF_IN_DECLARE),
bindings.getEnclosingAdvice().getSourceLocation(),
null);
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
@@ -316,9 +317,9 @@ public class IfPointcut extends Pointcut {
if (isDeclare(bindings.getEnclosingAdvice())) {
// Enforce rule about which designators are supported in declare
inAspect.getWorld().showMessage(IMessage.ERROR,
"if() pointcut designator cannot be used in declare statement",
bindings.getEnclosingAdvice().getSourceLocation(),
null);
WeaverMessages.format(WeaverMessages.IF_IN_DECLARE),
bindings.getEnclosingAdvice().getSourceLocation(),
null);
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}
return makeIfTruePointcut(state);

+ 3
- 4
weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java 查看文件

@@ -22,6 +22,7 @@ import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Test;

public class PerFromSuper extends PerClause {
@@ -52,14 +53,12 @@ public class PerFromSuper extends PerClause {
PerClause p = lookupConcretePerClause(inAspect.getSuperclass());
if (p == null) {
inAspect.getWorld().getMessageHandler().handleMessage(
MessageUtil.error("expected per clause on super aspect not found on " +
inAspect.getSuperclass(), getSourceLocation())
MessageUtil.error(WeaverMessages.format(WeaverMessages.MISSING_PER_CLAUSE,inAspect.getSuperclass()), getSourceLocation())
);
}
if (p.getKind() != kind) {
inAspect.getWorld().getMessageHandler().handleMessage(
MessageUtil.error("wrong kind of per clause on super, expected " +
kind + " but found " + p.getKind(),
MessageUtil.error(WeaverMessages.format(WeaverMessages.WRONG_PER_CLAUSE,kind,p.getKind()),
getSourceLocation())
);
}

+ 6
- 5
weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java 查看文件

@@ -29,6 +29,7 @@ import org.aspectj.weaver.ResolvedPointcutDefinition;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Test;

/**
@@ -218,7 +219,7 @@ public class ReferencePointcut extends Pointcut {
if (concretizing) {
//Thread.currentThread().dumpStack();
searchStart.getWorld().getMessageHandler().handleMessage(
MessageUtil.error("circular pointcut declaration involving: " + this,
MessageUtil.error(WeaverMessages.format(WeaverMessages.CIRCULAR_POINTCUT,this),
getSourceLocation()));
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}
@@ -236,7 +237,7 @@ public class ReferencePointcut extends Pointcut {
pointcutDec = searchStart.findPointcut(name);
if (pointcutDec == null) {
searchStart.getWorld().getMessageHandler().handleMessage(
MessageUtil.error("can't find pointcut \'" + name + "\' on " + searchStart.getName(),
MessageUtil.error(WeaverMessages.format(WeaverMessages.CANT_FIND_POINTCUT,name,searchStart.getName()),
getSourceLocation())
);
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
@@ -246,9 +247,9 @@ public class ReferencePointcut extends Pointcut {
//Thread.currentThread().dumpStack();
ShadowMunger enclosingAdvice = bindings.getEnclosingAdvice();
searchStart.getWorld().showMessage(IMessage.ERROR,
pointcutDec + " is abstract",
getSourceLocation(),
(null == enclosingAdvice) ? null : enclosingAdvice.getSourceLocation());
WeaverMessages.format(WeaverMessages.ABSTRACT_POINTCUT,pointcutDec),
getSourceLocation(),
(null == enclosingAdvice) ? null : enclosingAdvice.getSourceLocation());
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}

+ 3
- 2
weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java 查看文件

@@ -25,6 +25,7 @@ import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
import org.aspectj.weaver.ast.Var;
@@ -130,8 +131,8 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
if (isDeclare(bindings.getEnclosingAdvice())) {
// Enforce rule about which designators are supported in declare
inAspect.getWorld().showMessage(IMessage.ERROR,
(isThis?"this":"target")+"() pointcut designator cannot be used in declare statement",
bindings.getEnclosingAdvice().getSourceLocation(), null);
WeaverMessages.format(WeaverMessages.THIS_OR_TARGET_IN_DECLARE,isThis?"this":"target"),
bindings.getEnclosingAdvice().getSourceLocation(), null);
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}

+ 3
- 1
weaver/src/org/aspectj/weaver/patterns/TypePattern.java 查看文件

@@ -25,6 +25,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;
/**
* On creation, type pattern only contains WildTypePattern nodes, not BindingType or ExactType.
*
@@ -169,7 +170,8 @@ public abstract class TypePattern extends PatternNode {
}
protected TypePattern notExactType(IScope s) {
s.getMessageHandler().handleMessage(MessageUtil.error("exact type pattern required", getSourceLocation()));
s.getMessageHandler().handleMessage(MessageUtil.error(
WeaverMessages.format(WeaverMessages.EXACT_TYPE_PATTERN_REQD), getSourceLocation()));
return NO;
}

+ 3
- 2
weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java 查看文件

@@ -27,6 +27,7 @@ import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverMessages;

//XXX need to use dim in matching
public class WildTypePattern extends TypePattern {
@@ -348,7 +349,7 @@ public class WildTypePattern extends TypePattern {
if (requireExactType) {
if (!allowBinding) {
scope.getWorld().getMessageHandler().handleMessage(
MessageUtil.error("can't bind type name '" + originalName + "'",
MessageUtil.error(WeaverMessages.format(WeaverMessages.CANT_BIND_TYPE,originalName),
getSourceLocation()));
} else if (scope.getWorld().getLint().invalidAbsoluteTypeName.isEnabled()) {
scope.getWorld().getLint().invalidAbsoluteTypeName.signal(originalName, getSourceLocation());
@@ -366,7 +367,7 @@ public class WildTypePattern extends TypePattern {
} else {
if (requireExactType) {
scope.getWorld().getMessageHandler().handleMessage(
MessageUtil.error("wildcard type pattern not allowed, must use type name",
MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED),
getSourceLocation()));
return NO;
}

+ 99
- 0
weaver/src/org/aspectj/weaver/weaver-messages.properties 查看文件

@@ -0,0 +1,99 @@
#####################################################################
# Copyright (c) 2004 Contributors.
# All rights reserved.
# This program and the accompanying materials are made available
# under the terms of the Common Public License v1.0
# which accompanies this distribution and is available at
# http://www.eclipse.org/legal/cpl-v10.html
#
# Contributors:
# Adrian Colyer - Initial version
#####################################################################

# Messages output by the AspectJ Weaver

# Pointcut related messages...
argsInDeclare=args() pointcut designator cannot be used in declare statement
cflowInDeclare=cflow{0}() pointcut designator cannot be used in declare statement
ifInDeclare=if() pointcut designator cannot be used in declare statement
thisOrTargetInDeclare={0}() pointcut designator cannot be used in declare statement
abstractPointcut={0} is abstract
abstractPointcutNotMadeConcrete=inherited abstract {0} is not made concrete in {1}
conflictingInheritedPointcuts=conflicting inherited pointcuts in {0}
circularPointcutDeclaration=circular pointcut declaration involving: {0}
cantFindPointcut=can''t find pointcut ''{0}'' on {1}
exactTypePatternRequired=exact type pattern required
cantBindType=can''t bind type name ''{0}''
wildcardTypePatternNotAllowed=wildcard type pattern not allowed, must use type name

# Declare parents messages...
decpObject=can''t change the parents of java.lang.Object
cantExtendSelf=type ''{0}''can not extend itself
interfaceExtendClass=interface can not extend a class
decpHierarchy=can only insert a class into hierarchy, but {0} is not a subtype of {1}

# declare precedence messages...
multipleMatchesInPrecedence=multiple matches for {0}, matches both {1} and {2}
circularityInPrecedenceStar=circularity in declare precedence, ''*'' occurs more than once
nonAspectTypesInPrecedence=Non-aspect types can only be specified in a declare precedence statement when subtypes are included. Non-aspect type is : {0}
circularityInPrecedenceTwo=circularity in declare precedence, ''{0}'' matches two patterns

# declare soft messages...
notThrowable={0} is not a subtype of Throwable

# itd messages...
itdConsOnAspect=can''t declare constructor on an aspect
returnTypeMismatch=can''t override {0} with {1} return types don''t match
paramTypeMismatch=can''t override {0} with {1} parameter types don''t match
visibilityReduction=can''t override {0} with {1} visibility is reduced
doesntThrow=overriden method doesn't throw {0}
overriddenStatic={0} cannot override {1}; overridden method is static
overridingStatic={0} cannot override {1}; overriding method is static
itdConflict=intertype declaration from {0} conflicts with intertype declaration: {1} from {2}
itdMemberConflict=inter-type declaration from {0} conflicts with existing member: {1}

# advice messages...
nonVoidReturn=applying to join point that doesn't return void: {0}
incompatibleReturnType=incompatible return type applying to {0}
cantThrowChecked=can''t throw checked exception ''{0}'' at this join point ''{1}''
circularDependency=can''t determine precedence between two or more pieces of advice that apply the same join point: {0}

# aspect messages..
missingPerClause=expected per clause on super aspect not found on {0}
wrongPerClause=wrong kind of per clause on super, expected {0} but found {1}

# Reweavable messages...
alreadyWoven=class ''{0}'' is already woven and has not been built with -Xreweavable
reweavableMode=weaver operating in reweavable mode. Need to verify any required types exist.
processingReweavable=processing reweavable type {0}: {1}
missingReweavableType=type {0} is needed by reweavable type {1}
verifiedReweavableType=successfully verified type {0} exists. Originates from {1}
aspectNeeded=aspect {0} is needed when using type {1}

# The infamous and deserving a category all of its own...
cantFindType=can''t find type {0}

# Implementation limitations...
decpBinaryLimitation=can''t use declare parents to change superclass of binary form ''{0}'' (implementation limitation)
overwriteJSR45=overwriting JSR45 information for {0} (compiler limitation)
ifInPerClause=if() pointcut designator cannot be used directly in a per clause (compiler limitation). Create a named pointcut containing the if() and refer to it
ifLexicallyInCflow=if not supported lexically within cflow (compiler limitation)
onlyBeforeOnHandler=Only before advice is supported on handler join points (compiler limitation)
aroundOnPreInit=around on pre-initialization not supported (compiler limitation)
aroundOnInit=around on initialization not supported (compiler limitation)
aroundOnInterfaceStaticInit=around on staticinitialization of interface ''{0}'' not supported (compiler limitation)

# Bytecode generation nasties...
problemGeneratingMethod=problem generating method {0}.{1} : {2}

# Classpath messages
zipfileEntryMissing=zipfile classpath entry does not exist: {0}
zipfileEntryInvalid=zipfile classpath entry is invalid: {0} <{1}>
directoryEntryMissing=directory classpath entry does not exist: {0}

# Lint messages
problemLoadingXLint=problem loading Xlint properties file: {0}, {1}
unableToLoadXLintDefault=couldn''t load XlintDefault.properties
errorLoadingXLintDefault=problem loading XlintDefault.properties, {0}
invalidXLintKey=invalid Xlint key: {0}
invalidXLintMessageKind=invalid Xlint message kind (must be one of ignore, warning, error): {0}

+ 1
- 0
weaver/testsrc/org/aspectj/weaver/BcweaverTests.java 查看文件

@@ -53,6 +53,7 @@ public class BcweaverTests extends TestCase {
suite.addTestSuite(MemberTestCase.class);
suite.addTestSuite(TypeXTestCase.class);
suite.addTestSuite(WeavingURLClassLoaderTest.class);
suite.addTestSuite(WeaverMessagesTestCase.class);
//$JUnit-END$
return suite;
}

+ 50
- 0
weaver/testsrc/org/aspectj/weaver/WeaverMessagesTestCase.java 查看文件

@@ -0,0 +1,50 @@
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.aspectj.weaver;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.MissingResourceException;

import junit.framework.TestCase;

/**
* @author colyer
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class WeaverMessagesTestCase extends TestCase {
public void testAllMessagesDefined() {
Class wmClass = WeaverMessages.class;
Field[] fields = wmClass.getDeclaredFields();
List fieldList = new ArrayList();
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
if (f.getType() == String.class) {
try {
String key = (String) f.get(null);
String value = WeaverMessages.format(key);
assertFalse("Each key should be unique",fieldList.contains(key));
fieldList.add(key);
// System.out.println(key + "," + value);
} catch (IllegalAccessException ex) {
} catch(MissingResourceException mrEx) {
fail("Missing resource: " + mrEx);
}
}
}
}

}

Loading…
取消
儲存