From baaa16f087bcfbd7408aad29025ca2e20ec2c650 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 5 Aug 2011 16:23:29 +0000 Subject: [PATCH] minimalModel ON by default. demotion ON by default (for AJDT as well as LTW) --- ajdoc/src/org/aspectj/tools/ajdoc/Main.java | 2 +- .../aspectj/tools/ajdoc/AjdocTestCase.java | 202 ++++++++---------- 2 files changed, 92 insertions(+), 112 deletions(-) diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java index ed384642e..5c9047dcb 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java @@ -475,7 +475,7 @@ public class Main implements Config { } } List vargs = new LinkedList(Arrays.asList(args)); - + vargs.add("-Xset:minimalModel=false"); parseArgs(vargs, new File(".")); // !!! if (filenames.size() == 0) { diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java index 8c7c05d9c..2db299f37 100644 --- a/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java +++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java @@ -21,17 +21,15 @@ import junit.framework.TestCase; import org.aspectj.tools.ajc.Ajc; /** - * This class is the super class of all Ajdoc tests. It creates - * a sandbox directory and provides utility methods for - * copying over the test projects and running the ajdoc command + * This class is the super class of all Ajdoc tests. It creates a sandbox directory and provides utility methods for copying over + * the test projects and running the ajdoc command */ -public class AjdocTestCase extends TestCase{ +public class AjdocTestCase extends TestCase { public final static String testdataSrcDir = "../ajdoc/testdata"; - protected static File sandboxDir; + protected static File sandboxDir; private String docOutdir, projectDir; - protected void setUp() throws Exception { super.setUp(); docOutdir = null; @@ -47,132 +45,125 @@ public class AjdocTestCase extends TestCase{ // reset where ajdocworkingdir is created Main.resetOutputWorkingDir(); } - + /** - * Fill in the working directory with the project files and - * create a doc top level directory in which to generate - * the ajdoc output. + * Fill in the working directory with the project files and create a doc top level directory in which to generate the ajdoc + * output. */ public void initialiseProject(String projectName) { - File projectSrc=new File(testdataSrcDir + File.separatorChar + projectName); - File destination=new File(getWorkingDir(),projectName); - if (!destination.exists()) {destination.mkdir();} - copy(projectSrc,destination); + File projectSrc = new File(testdataSrcDir + File.separatorChar + projectName); + File destination = new File(getWorkingDir(), projectName); + if (!destination.exists()) { + destination.mkdir(); + } + copy(projectSrc, destination); projectDir = destination.getAbsolutePath(); - - File docDestination = new File(getWorkingDir().toString() + File.separatorChar + projectName,"doc"); - if (!docDestination.exists()) {docDestination.mkdir();} - docOutdir = docDestination.getAbsolutePath(); + + File docDestination = new File(getWorkingDir().toString() + File.separatorChar + projectName, "doc"); + if (!docDestination.exists()) { + docDestination.mkdir(); + } + docOutdir = docDestination.getAbsolutePath(); } - + /** * @return the working directory */ - protected File getWorkingDir() { - return sandboxDir; + protected File getWorkingDir() { + return sandboxDir; } - + /** - * @return the absolute path of the project directory - * for example c:\temp\ajcSandbox\ajcTest15200.tmp\myProject + * @return the absolute path of the project directory for example c:\temp\ajcSandbox\ajcTest15200.tmp\myProject */ protected String getAbsoluteProjectDir() { return projectDir; } - + /** - * @return the absolute path of the doc output directory - * for example c:\temp\ajcSandbox\ajcTest15200.tmp\myProject\doc + * @return the absolute path of the doc output directory for example c:\temp\ajcSandbox\ajcTest15200.tmp\myProject\doc */ protected String getAbsolutePathOutdir() { return docOutdir; } - + /** - * Copy the contents of some directory to another location - the - * copy is recursive. + * Copy the contents of some directory to another location - the copy is recursive. */ private void copy(File from, File to) { String contents[] = from.list(); - if (contents==null) return; + if (contents == null) + return; for (int i = 0; i < contents.length; i++) { String string = contents[i]; - File f = new File(from,string); - File t = new File(to,string); - + File f = new File(from, string); + File t = new File(to, string); + if (f.isDirectory()) { t.mkdir(); - copy(f,t); + copy(f, t); } else if (f.isFile()) { try { - org.aspectj.util.FileUtil.copyFile(f,t); + org.aspectj.util.FileUtil.copyFile(f, t); } catch (IOException e) { throw new AssertionFailedError("Unable to copy " + f + " to " + t); } - } + } } } - + /** - * Run the ajdoc command with the given visibility argument, - * the default source level and the given input files. + * Run the ajdoc command with the given visibility argument, the default source level and the given input files. */ public void runAjdoc(String visibility, File[] inputFiles) { - if (!visibility.equals("public") - && !visibility.equals("protected") - && !visibility.equals("private")) { - fail("need to pass 'public','protected' or 'private' visibility to ajdoc"); + if (!visibility.equals("public") && !visibility.equals("protected") && !visibility.equals("private")) { + fail("need to pass 'public','protected' or 'private' visibility to ajdoc"); } if (inputFiles.length == 0) { fail("need to pass some files into ajdoc"); - } - String[] args = new String[5 + inputFiles.length]; + } + String[] args = new String[5 + inputFiles.length]; args[0] = "-" + visibility; args[1] = "-classpath"; args[2] = AjdocTests.ASPECTJRT_PATH.getPath(); args[3] = "-d"; args[4] = getAbsolutePathOutdir(); for (int i = 0; i < inputFiles.length; i++) { - args[5+i] = inputFiles[i].getAbsolutePath(); + args[5 + i] = inputFiles[i].getAbsolutePath(); } - org.aspectj.tools.ajdoc.Main.main(args); + org.aspectj.tools.ajdoc.Main.main(args); } - + /** - * Run the ajdoc command with the default visibility - * and source level and the given input files. + * Run the ajdoc command with the default visibility and source level and the given input files. */ public void runAjdoc(File[] inputFiles) { if (inputFiles.length == 0) { fail("need to pass some files into ajdoc"); - } - String[] args = new String[4 + inputFiles.length]; + } + String[] args = new String[4 + inputFiles.length]; args[0] = "-classpath"; args[1] = AjdocTests.ASPECTJRT_PATH.getPath(); args[2] = "-d"; args[3] = getAbsolutePathOutdir(); for (int i = 0; i < inputFiles.length; i++) { - args[4+i] = inputFiles[i].getAbsolutePath(); + args[4 + i] = inputFiles[i].getAbsolutePath(); } - org.aspectj.tools.ajdoc.Main.main(args); + org.aspectj.tools.ajdoc.Main.main(args); } - + /** - * Run the ajdoc command with the default visibility - * and source level, the given input files and the given - * aspectj options + * Run the ajdoc command with the default visibility and source level, the given input files and the given aspectj options */ public void runAjdoc(File[] inputFiles, String sourceLevel, String[] ajOptions) { if (inputFiles.length == 0) { fail("need to pass some files into ajdoc"); - } - if (!sourceLevel.equals("1.3") - && !sourceLevel.equals("1.4") - && !sourceLevel.equals("1.5")) { + } + if (!sourceLevel.equals("1.3") && !sourceLevel.equals("1.4") && !sourceLevel.equals("1.5")) { fail("need to pass ajdoc '1.3', '1.4', or '1.5' as the source level"); } - String[] args = new String[6 + inputFiles.length + ajOptions.length]; - args[0] = "-source"; + String[] args = new String[6 + inputFiles.length + ajOptions.length]; + args[0] = "-source"; args[1] = sourceLevel; args[2] = "-classpath"; args[3] = AjdocTests.ASPECTJRT_PATH.getPath(); @@ -182,36 +173,31 @@ public class AjdocTestCase extends TestCase{ args[6 + i] = ajOptions[i]; } for (int i = 0; i < inputFiles.length; i++) { - args[6 + i +ajOptions.length] = inputFiles[i].getAbsolutePath(); + args[6 + i + ajOptions.length] = inputFiles[i].getAbsolutePath(); } - org.aspectj.tools.ajdoc.Main.main(args); + org.aspectj.tools.ajdoc.Main.main(args); } - + /** - * Run the ajdoc command with the given visibility argument, - * the given source level argument and the given input files. + * Run the ajdoc command with the given visibility argument, the given source level argument and the given input files. */ public void runAjdoc(String visibility, String sourceLevel, File[] inputFiles) { - if (!visibility.equals("public") - && !visibility.equals("protected") - && !visibility.equals("private")) { + if (!visibility.equals("public") && !visibility.equals("protected") && !visibility.equals("private")) { fail("need to pass 'public','protected' or 'private' visibility to ajdoc"); } - if (!sourceLevel.equals("1.3") - && !sourceLevel.equals("1.4") - && !sourceLevel.equals("1.5")) { + if (!sourceLevel.equals("1.3") && !sourceLevel.equals("1.4") && !sourceLevel.equals("1.5")) { fail("need to pass ajdoc '1.3', '1.4', or '1.5' as the source level"); } if (inputFiles.length == 0) { fail("need to pass some files into ajdoc"); - } + } for (int i = 0; i < inputFiles.length; i++) { if (!inputFiles[i].exists()) { fail(inputFiles[i].getAbsolutePath() + " does not exist"); } } - - String[] args = new String[7 + inputFiles.length]; + + String[] args = new String[7 + inputFiles.length]; args[0] = "-" + visibility; args[1] = "-source"; args[2] = sourceLevel; @@ -219,26 +205,24 @@ public class AjdocTestCase extends TestCase{ args[4] = AjdocTests.ASPECTJRT_PATH.getPath(); args[5] = "-d"; args[6] = getAbsolutePathOutdir(); + // args[7] = "-Xset:minimalModel=false"; for (int i = 0; i < inputFiles.length; i++) { - args[7+i] = inputFiles[i].getAbsolutePath(); + args[7 + i] = inputFiles[i].getAbsolutePath(); } - org.aspectj.tools.ajdoc.Main.main(args); + org.aspectj.tools.ajdoc.Main.main(args); } - + /** - * Run the ajdoc command with the given visibility argument, - * the default source level and the given input directories. + * Run the ajdoc command with the given visibility argument, the default source level and the given input directories. */ public void runAjdoc(String visibility, String[] directoryNames) { - if (!visibility.equals("public") - && !visibility.equals("protected") - && !visibility.equals("private")) { - fail("need to pass 'public','protected' or 'private' visibility to ajdoc"); + if (!visibility.equals("public") && !visibility.equals("protected") && !visibility.equals("private")) { + fail("need to pass 'public','protected' or 'private' visibility to ajdoc"); } if (directoryNames.length == 0) { fail("need to pass some directories into ajdoc"); - } - String[] args = new String[7 + directoryNames.length]; + } + String[] args = new String[7 + directoryNames.length]; args[0] = "-" + visibility; args[1] = "-classpath"; args[2] = AjdocTests.ASPECTJRT_PATH.getPath(); @@ -247,20 +231,19 @@ public class AjdocTestCase extends TestCase{ args[5] = "-sourcepath"; args[6] = getAbsoluteProjectDir(); for (int i = 0; i < directoryNames.length; i++) { - args[7+i] = directoryNames[i]; + args[7 + i] = directoryNames[i]; } - org.aspectj.tools.ajdoc.Main.main(args); + org.aspectj.tools.ajdoc.Main.main(args); } - + /** - * Run the ajdoc command with the default visibility and - * source level and the given input directories. + * Run the ajdoc command with the default visibility and source level and the given input directories. */ public void runAjdoc(String[] directoryNames) { if (directoryNames.length == 0) { fail("need to pass some directories into ajdoc"); - } - String[] args = new String[6 + directoryNames.length]; + } + String[] args = new String[6 + directoryNames.length]; args[0] = "-classpath"; args[1] = AjdocTests.ASPECTJRT_PATH.getPath(); args[2] = "-d"; @@ -268,23 +251,20 @@ public class AjdocTestCase extends TestCase{ args[4] = "-sourcepath"; args[5] = getAbsoluteProjectDir(); for (int i = 0; i < directoryNames.length; i++) { - args[6+i] = directoryNames[i]; + args[6 + i] = directoryNames[i]; } - org.aspectj.tools.ajdoc.Main.main(args); + org.aspectj.tools.ajdoc.Main.main(args); } - + /** - * Run the ajdoc command with the given visibility argument, - * the default source level and the given input directories. + * Run the ajdoc command with the given visibility argument, the default source level and the given input directories. */ public void runAjdoc(String visibility, String lstFile) { - if (!visibility.equals("public") - && !visibility.equals("protected") - && !visibility.equals("private")) { - fail("need to pass 'public','protected' or 'private' visibility to ajdoc"); + if (!visibility.equals("public") && !visibility.equals("protected") && !visibility.equals("private")) { + fail("need to pass 'public','protected' or 'private' visibility to ajdoc"); } - - String[] args = new String[8]; + + String[] args = new String[8]; args[0] = "-" + visibility; args[1] = "-classpath"; args[2] = AjdocTests.ASPECTJRT_PATH.getPath(); @@ -293,15 +273,15 @@ public class AjdocTestCase extends TestCase{ args[5] = "-sourcepath"; args[6] = getAbsoluteProjectDir(); args[7] = "@" + getAbsoluteProjectDir() + File.separatorChar + lstFile; - org.aspectj.tools.ajdoc.Main.main(args); + org.aspectj.tools.ajdoc.Main.main(args); } - + /** * Run the ajdoc command with the given options */ public void runAjdoc(List options) { String[] args = new String[options.size()]; - int i = 0; + int i = 0; for (Iterator iter = options.iterator(); iter.hasNext();) { String element = (String) iter.next(); args[i] = element; -- 2.39.5