diff options
author | Andy Clement <aclement@pivotal.io> | 2020-07-22 14:09:06 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2020-07-22 14:09:06 -0700 |
commit | c3289ab86bfb2c97cf34147239b3dde46de92a7c (patch) | |
tree | 9c52e4420eb874ccabc8e265b9cabaaf8717f815 /org.aspectj.matcher/src | |
parent | 5c82acb58e2d665a46529290ae85ae717cbf2bd3 (diff) | |
download | aspectj-c3289ab86bfb2c97cf34147239b3dde46de92a7c.tar.gz aspectj-c3289ab86bfb2c97cf34147239b3dde46de92a7c.zip |
Polish
Diffstat (limited to 'org.aspectj.matcher/src')
3 files changed, 73 insertions, 59 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SimpleAnnotationValue.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SimpleAnnotationValue.java index 312f7726b..27af4e8f5 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SimpleAnnotationValue.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SimpleAnnotationValue.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2006 Contributors - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Andy Clement IBM initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement IBM initial implementation * ******************************************************************/ package org.aspectj.weaver; @@ -78,6 +78,7 @@ public class SimpleAnnotationValue extends AnnotationValue { theInt = i; } + @Override public String stringify() { switch (valueKind) { case 'B': // byte @@ -95,7 +96,7 @@ public class SimpleAnnotationValue extends AnnotationValue { case 'S': // short return Short.toString(theShort); case 'Z': // boolean - return new Boolean(theBoolean).toString(); + return Boolean.valueOf(theBoolean).toString(); case 's': // String return theString; default: @@ -103,6 +104,7 @@ public class SimpleAnnotationValue extends AnnotationValue { } } + @Override public String toString() { return stringify(); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java index 68353422f..d54ad29ab 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * PARC initial implementation * ******************************************************************/ package org.aspectj.weaver.patterns; @@ -97,7 +97,7 @@ public class ExactTypePattern extends TypePattern { /* * (non-Javadoc) - * + * * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern) */ @Override @@ -234,8 +234,8 @@ public class ExactTypePattern extends TypePattern { public int hashCode() { int result = 17; result = 37 * result + type.hashCode(); - result = 37 * result + new Boolean(includeSubtypes).hashCode(); - result = 37 * result + new Boolean(isVarArgs).hashCode(); + result = 37 * result + Boolean.valueOf(includeSubtypes).hashCode(); + result = 37 * result + Boolean.valueOf(isVarArgs).hashCode(); result = 37 * result + typeParameters.hashCode(); result = 37 * result + annotationPattern.hashCode(); return result; @@ -322,7 +322,7 @@ public class ExactTypePattern extends TypePattern { TypeVariableReference t = (TypeVariableReference) type; String key = t.getTypeVariable().getName(); if (typeVariableMap.containsKey(key)) { - newType = (UnresolvedType) typeVariableMap.get(key); + newType = typeVariableMap.get(key); } } else if (type.isParameterizedType()) { newType = w.resolve(type).parameterize(typeVariableMap); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/AbstractTrace.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/AbstractTrace.java index 52217f880..252a164fe 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/AbstractTrace.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/AbstractTrace.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Matthew Webster - initial implementation *******************************************************************************/ @@ -27,17 +27,21 @@ public abstract class AbstractTrace implements Trace { protected Class<?> tracedClass; private static SimpleDateFormat timeFormat; - + protected AbstractTrace (Class clazz) { this.tracedClass = clazz; } - + + @Override public abstract void enter (String methodName, Object thiz, Object[] args); - + + @Override public abstract void enter(String methodName, Object thiz); + @Override public abstract void exit(String methodName, Object ret); + @Override public abstract void exit(String methodName, Throwable th); /* @@ -47,38 +51,46 @@ public abstract class AbstractTrace implements Trace { enter(methodName,null,null); } + @Override public void enter (String methodName, Object thiz, Object arg) { enter(methodName,thiz,new Object[] { arg }); } + @Override public void enter (String methodName, Object thiz, boolean z) { - enter(methodName,thiz,new Boolean(z)); + enter(methodName,thiz,Boolean.valueOf(z)); } + @Override public void exit (String methodName, boolean b) { - exit(methodName,new Boolean(b)); + exit(methodName,Boolean.valueOf(b)); } + @Override public void exit (String methodName, int i) { exit(methodName,new Integer(i)); } + @Override public void event (String methodName, Object thiz, Object arg) { event(methodName,thiz,new Object[] { arg }); } + @Override public void warn(String message) { warn(message,null); } + @Override public void error(String message) { error(message,null); } + @Override public void fatal (String message) { fatal(message,null); } - + /* * Formatting */ @@ -94,7 +106,7 @@ public abstract class AbstractTrace implements Trace { if (args != null) message.append(" ").append(formatArgs(args)); return message.toString(); } - + /** * @param className full dotted class name * @return short version of class name with package collapse to initials @@ -102,7 +114,7 @@ public abstract class AbstractTrace implements Trace { private String formatClassName(String className) { return packagePrefixPattern.matcher(className).replaceAll("$1."); } - + protected String formatMessage(String kind, String text, Throwable th) { StringBuffer message = new StringBuffer(); Date now = new Date(); @@ -113,37 +125,37 @@ public abstract class AbstractTrace implements Trace { if (th != null) message.append(" ").append(formatObj(th)); return message.toString(); } - + private static String formatDate (Date date) { if (timeFormat == null) { timeFormat = new SimpleDateFormat("HH:mm:ss.SSS"); } - + return timeFormat.format(date); } /** * Format objects safely avoiding toString which can cause recursion, * NullPointerExceptions or highly verbose results. - * + * * @param obj parameter to be formatted * @return the formatted parameter */ protected Object formatObj(Object obj) { - + /* These classes have a safe implementation of toString() */ if (obj == null || obj instanceof String - || obj instanceof Number - || obj instanceof Boolean - || obj instanceof Exception - || obj instanceof Character - || obj instanceof Class - || obj instanceof File - || obj instanceof StringBuffer - || obj instanceof URL - || obj instanceof Kind - ) return obj; + || obj instanceof Number + || obj instanceof Boolean + || obj instanceof Exception + || obj instanceof Character + || obj instanceof Class + || obj instanceof File + || obj instanceof StringBuffer + || obj instanceof URL + || obj instanceof Kind + ) return obj; else if (obj.getClass().isArray()) { return formatArray(obj); } @@ -151,52 +163,52 @@ public abstract class AbstractTrace implements Trace { return formatCollection((Collection)obj); } else try { - + // Classes can provide an alternative implementation of toString() if (obj instanceof Traceable) { return ((Traceable)obj).toTraceString(); } - + // classname@hashcode else return formatClassName(obj.getClass().getName()) + "@" + Integer.toHexString(System.identityHashCode(obj)); - - /* Object.hashCode() can be override and may thow an exception */ + + /* Object.hashCode() can be override and may thow an exception */ } catch (Exception ex) { return obj.getClass().getName() + "@FFFFFFFF"; } } - + protected String formatArray(Object obj) { - return obj.getClass().getComponentType().getName() + "[" + Array.getLength(obj) + "]"; + return obj.getClass().getComponentType().getName() + "[" + Array.getLength(obj) + "]"; } - + protected String formatCollection(Collection<?> c) { - return c.getClass().getName() + "(" + c.size() + ")"; + return c.getClass().getName() + "(" + c.size() + ")"; } - /** + /** * Format arguments into a comma separated list - * + * * @param names array of argument names * @param args array of arguments * @return the formated list */ protected String formatArgs(Object[] args) { StringBuffer sb = new StringBuffer(); - + for (int i = 0; i < args.length; i++) { sb.append(formatObj(args[i])); if (i < args.length-1) sb.append(", "); } - + return sb.toString(); } - + protected Object[] formatObjects(Object[] args) { for (int i = 0; i < args.length; i++) { args[i] = formatObj(args[i]); } - + return args; } }
\ No newline at end of file |