summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorAndy Clement <andrew.clement@gmail.com>2012-08-23 12:19:58 -0700
committerAndy Clement <andrew.clement@gmail.com>2012-08-23 12:19:58 -0700
commit76d695ff1a6f8863a1b64f17e38a5ffee170f09f (patch)
tree2626329dfe39c9587ff7617c81d3620a529e34a3 /org.aspectj.ajdt.core
parent5ef30bda739949d9f01b2b1792322382018e2be1 (diff)
downloadaspectj-76d695ff1a6f8863a1b64f17e38a5ffee170f09f.tar.gz
aspectj-76d695ff1a6f8863a1b64f17e38a5ffee170f09f.zip
387444
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java59
1 files changed, 57 insertions, 2 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
index f43281317..2808b3436 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
@@ -100,8 +100,9 @@ public class AjProblemReporter extends ProblemReporter {
// System.err.println("about to show error for unhandled exception: " + new String(exceptionType.sourceName()) +
// " at " + location + " in " + referenceContext);
- for (Iterator i = factory.getWorld().getDeclareSoft().iterator(); i.hasNext();) {
- DeclareSoft d = (DeclareSoft) i.next();
+ for (DeclareSoft d: factory.getWorld().getDeclareSoft()) {
+// for (Iterator<DeclareSoft> i = factory.getWorld().getDeclareSoft().iterator(); i.hasNext();) {
+// DeclareSoft d = (DeclareSoft) i.next();
// We need the exceptionType to match the type in the declare soft statement
// This means it must either be the same type or a subtype
ResolvedType throwException = factory.fromEclipse((ReferenceBinding) exceptionType);
@@ -139,6 +140,60 @@ public class AjProblemReporter extends ProblemReporter {
super.unhandledException(exceptionType, location);
}
+
+ public void unhandledExceptionFromAutoClose(TypeBinding exceptionType, ASTNode location) {
+ if (!factory.getWorld().getDeclareSoft().isEmpty()) {
+ Shadow callSite = factory.makeShadow(location, referenceContext);
+ Shadow enclosingExec = factory.makeShadow(referenceContext);
+ // PR 72157 - calls to super / this within a constructor are not part of the cons join point.
+ if ((callSite == null) && (enclosingExec.getKind() == Shadow.ConstructorExecution)
+ && (location instanceof ExplicitConstructorCall)) {
+ super.unhandledException(exceptionType, location);
+ return;
+ }
+ // System.err.println("about to show error for unhandled exception: " + new String(exceptionType.sourceName()) +
+ // " at " + location + " in " + referenceContext);
+
+ for (DeclareSoft d: factory.getWorld().getDeclareSoft()) {
+// for (Iterator<DeclareSoft> i = factory.getWorld().getDeclareSoft().iterator(); i.hasNext();) {
+// DeclareSoft d = (DeclareSoft) i.next();
+ // We need the exceptionType to match the type in the declare soft statement
+ // This means it must either be the same type or a subtype
+ ResolvedType throwException = factory.fromEclipse((ReferenceBinding) exceptionType);
+ FuzzyBoolean isExceptionTypeOrSubtype = d.getException().matchesInstanceof(throwException);
+ if (!isExceptionTypeOrSubtype.alwaysTrue())
+ continue;
+
+ if (callSite != null) {
+ FuzzyBoolean match = d.getPointcut().match(callSite);
+ if (match.alwaysTrue()) {
+ // System.err.println("matched callSite: " + callSite + " with " + d);
+ return;
+ } else if (!match.alwaysFalse()) {
+ // !!! need this check to happen much sooner
+ // throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
+ }
+ }
+ if (enclosingExec != null) {
+ FuzzyBoolean match = d.getPointcut().match(enclosingExec);
+ if (match.alwaysTrue()) {
+ // System.err.println("matched enclosingExec: " + enclosingExec + " with " + d);
+ return;
+ } else if (!match.alwaysFalse()) {
+ // !!! need this check to happen much sooner
+ // throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
+ }
+ }
+ }
+ }
+
+ // ??? is this always correct
+ if (location instanceof Proceed) {
+ return;
+ }
+
+ super.unhandledExceptionFromAutoClose(exceptionType, location);
+ }
private boolean isPointcutDeclaration(MethodBinding binding) {
return CharOperation.prefixEquals(PointcutDeclaration.mangledPrefix, binding.selector);