[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-dev] Providing patches etc
|
Kev Jackson wrote:
Also, we won't put anything into the codebase unless it passes the
RunTheseBeforeYouCommitTests in the run-all-junit-tests project - this
executes all ~1450 tests currently written for AspectJ. The build
machine will later run these on Java1.3 and Java1.4 (and shortly
Java1.5).
Is there a particular area you want to look at - I could send a bug or
two your way if you like? theres more than enough to go round :)
Ok, well because eclipse complains about it, I started working on
externalizing strings - I'd make a bug in Bugzilla and then attach
patches against that, except we're having problems with our web
connections - not sure why, but email is fine and so is external cvs.
So here's a patch to externalize strings from
org.aspectj.weaver.tools.PointcutParser.
Later on I may be able to provide the message bundles in three other
languages (Japanese, Chinese and Vietnamese), so there is a point to
externalizing them!
Kev
Index: PointcutParser.java
===================================================================
RCS file: /home/technology/org.aspectj/modules/weaver/src/org/aspectj/weaver/tools/PointcutParser.java,v
retrieving revision 1.2
diff -u -r1.2 PointcutParser.java
--- PointcutParser.java 3 Dec 2004 11:53:29 -0000 1.2
+++ PointcutParser.java 25 Jan 2005 06:40:02 -0000
@@ -93,7 +93,7 @@
if ((element == PointcutPrimitives.IF) ||
(element == PointcutPrimitives.CFLOW) ||
(element == PointcutPrimitives.CFLOW_BELOW)) {
- throw new UnsupportedOperationException("Cannot handle if, cflow, and cflowbelow primitives");
+ throw new UnsupportedOperationException("Cannot handle if, cflow, and cflowbelow primitives"); //$NON-NLS-1$
}
}
}
@@ -133,18 +133,18 @@
break;
case Pointcut.ARGS:
if (!supportedPrimitives.contains(PointcutPrimitives.ARGS))
- throw new UnsupportedOperationException("args is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.ARGS));
break;
case Pointcut.CFLOW:
- throw new UnsupportedOperationException("cflow and cflowbelow are not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.CFLOW));
case Pointcut.HANDLER:
if (!supportedPrimitives.contains(PointcutPrimitives.HANDLER))
- throw new UnsupportedOperationException("handler is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.HANDLER));
break;
case Pointcut.IF:
case Pointcut.IF_FALSE:
case Pointcut.IF_TRUE:
- throw new UnsupportedOperationException("if is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.IF));
case Pointcut.KINDED:
validateKindedPointcut(((KindedPointcut)pc));
break;
@@ -156,26 +156,26 @@
validateAgainstSupportedPrimitives(((OrPointcut)pc).getRight());
break;
case Pointcut.REFERENCE:
- throw new UnsupportedOperationException("if pointcuts and reference pointcuts are not supported by this parser");
+ throw new UnsupportedOperationException(Messages.getString("PointcutPrimitives.REFERENCE")); //$NON-NLS-1$
case Pointcut.THIS_OR_TARGET:
boolean isThis = ((ThisOrTargetPointcut)pc).isThis();
if (isThis && !supportedPrimitives.contains(PointcutPrimitives.THIS)) {
- throw new UnsupportedOperationException("this is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.THIS));
} else if (!supportedPrimitives.contains(PointcutPrimitives.TARGET)) {
- throw new UnsupportedOperationException("target is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.TARGET));
}
break;
case Pointcut.WITHIN:
if (!supportedPrimitives.contains(PointcutPrimitives.WITHIN))
- throw new UnsupportedOperationException("within is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.WITHIN));
break;
case Pointcut.WITHINCODE:
if (!supportedPrimitives.contains(PointcutPrimitives.WITHIN_CODE))
- throw new UnsupportedOperationException("withincode is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.WITHIN_CODE));
break;
case Pointcut.NONE: // deliberate fall-through
default:
- throw new UnsupportedOperationException("Unknown pointcut kind: " + pc.getPointcutKind());
+ throw new UnsupportedOperationException("Unknown pointcut kind: " + pc.getPointcutKind()); //$NON-NLS-1$
}
}
@@ -183,28 +183,28 @@
Shadow.Kind kind = pc.getKind();
if ((kind == Shadow.MethodCall) || (kind == Shadow.ConstructorCall)) {
if (!supportedPrimitives.contains(PointcutPrimitives.CALL))
- throw new UnsupportedOperationException("call is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.CALL));
} else if ((kind == Shadow.MethodExecution) || (kind == Shadow.ConstructorExecution)) {
if (!supportedPrimitives.contains(PointcutPrimitives.EXECUTION))
- throw new UnsupportedOperationException("execution is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.EXECUTION));
} else if (kind == Shadow.AdviceExecution) {
if (!supportedPrimitives.contains(PointcutPrimitives.ADVICE_EXECUTION))
- throw new UnsupportedOperationException("adviceexecution is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.ADVICE_EXECUTION));
} else if (kind == Shadow.FieldGet) {
if (!supportedPrimitives.contains(PointcutPrimitives.GET))
- throw new UnsupportedOperationException("get is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.GET));
} else if (kind == Shadow.FieldSet) {
if (!supportedPrimitives.contains(PointcutPrimitives.SET))
- throw new UnsupportedOperationException("set is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.SET));
} else if (kind == Shadow.Initialization) {
if (!supportedPrimitives.contains(PointcutPrimitives.INITIALIZATION))
- throw new UnsupportedOperationException("initialization is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.INITIALIZATION));
} else if (kind == Shadow.PreInitialization) {
if (!supportedPrimitives.contains(PointcutPrimitives.PRE_INITIALIZATION))
- throw new UnsupportedOperationException("preinitialization is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.PRE_INITIALIZATION));
} else if (kind == Shadow.StaticInitialization) {
if (!supportedPrimitives.contains(PointcutPrimitives.STATIC_INITIALIZATION))
- throw new UnsupportedOperationException("staticinitialization is not supported by this parser");
+ throw new UnsupportedOperationException(Messages.get(PointcutPrimitives.STATIC_INITIALIZATION));
}
}
-}
+}
\ No newline at end of file
Index: Messages.java
===================================================================
RCS file: Messages.java
diff -N Messages.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Messages.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2005 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.tools;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "org.aspectj.weaver.tools.messages";//$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ //private constructor, just use static methods
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+
+ public static String get(PointcutPrimitives key) {
+ return getString(key.getName());
+ }
+}
Index: messages.properties
===================================================================
RCS file: messages.properties
diff -N messages.properties
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ messages.properties 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,17 @@
+PointcutPrimitives.CALL=call is not supported by this parser
+PointcutPrimitives.ARGS=args is not supported by this parser
+PointcutPrimitives.CFLOW=cflow and cflowbelow are not supported by this parser
+PointcutPrimitives.THIS=this is not supported by this parser
+PointcutPrimitives.TARGET=target is not supported by this parser
+PointcutPrimitives.WITHIN=within is not supported by this parser
+PointcutPrimitives.EXECUTION=execution is not supported by this parser
+PointcutPrimitives.Handler=handler is not supported by this parser
+PointcutPrimitives.REFERENCE=if pointcuts and reference pointcuts are not supported by this parser
+PointcutPrimitives.WITHIN_CODE=withincode is not supported by this parser
+PointcutPrimitives.ADVICE_EXECUTION=adviceexecution is not supported by this parser
+PointcutPrimitives.GET=get is not supported by this parser
+PointcutPrimitives.SET=set is not supported by this parser
+PointcutPrimitives.IF=if is not supported by this parser
+PointcutPrimitives.INITIALIZATION=initialization is not supported by this parser
+PointcutPrimitives.PRE_INITIALIZATION=preinitialization is not supported by this parser
+PointcutPrimitives.STATIC_INITIALIZATION=staticinitialization is not supported by this parser