From f236927770b4c1029e4d108c3991870609555dfb Mon Sep 17 00:00:00 2001 From: jhugunin Date: Sun, 27 Apr 2003 23:29:27 +0000 Subject: [PATCH] fix and test for Bugzilla Bug 34951 NPE compiling without aspectjrt.jar --- .../internal/core/builder/AjBuildManager.java | 9 ++++++++ .../compiler/batch/BasicCommandTestCase.java | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index a39d4d8a9..b9a1ea588 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -45,6 +45,7 @@ import org.aspectj.bridge.IProgressListener; import org.aspectj.bridge.Message; import org.aspectj.bridge.MessageUtil; import org.aspectj.bridge.Version; +import org.aspectj.weaver.ResolvedTypeX; import org.aspectj.weaver.World; import org.aspectj.weaver.bcel.BcelWeaver; import org.aspectj.weaver.bcel.BcelWorld; @@ -285,6 +286,14 @@ public class AjBuildManager { File inJar = (File)i.next(); bcelWeaver.addJarFile(inJar, buildConfig.getOutputDir()); } + + //check for org.aspectj.runtime.JoinPoint + bcelWorld.resolve("org.aspectj.lang.JoinPoint"); + +// if () { +// bcelWorld.showMessage(IMessage.ERROR, +// "can't find type org.aspectj.lang.JoinPoint on classpath", null, null); +// } } public World getWorld() { diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java index 107921ca0..14736ab99 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java @@ -15,6 +15,10 @@ package org.aspectj.ajdt.internal.compiler.batch; import java.util.ArrayList; import java.util.List; +import org.aspectj.ajdt.ajc.AjdtCommand; +import org.aspectj.bridge.ICommand; +import org.aspectj.bridge.MessageHandler; + /** * @author hugunin * @@ -96,4 +100,21 @@ public class BasicCommandTestCase extends CommandTestCase { runCompiler(args, new int[] {2}); } + public void testMissingRuntimeError() { + List args = new ArrayList(); + + args.add("-d"); + args.add("out"); + + args.add("-classpath"); + args.add("../lib/junit/junit.jar;../testing-client/bin"); + args.add("testdata/src1/Xlint.java"); + + ICommand command = new AjdtCommand(); + MessageHandler myHandler = new MessageHandler(); + myHandler.setInterceptor(org.aspectj.tools.ajc.Main.MessagePrinter.TERSE); + boolean result = command.runCommand((String[])args.toArray(new String[args.size()]), myHandler); + + assertEquals("error for org.aspectj.lang.JoinPoint not found", 1, myHandler.getErrors().length); + } } -- 2.39.5