git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270641 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -54,10 +54,10 @@ | |||
| /* build notes | |||
| -The reference CD to listen to while editing this file is | |||
| -The reference CD to listen to while editing this file is | |||
| nap: Underworld - Everything, Everything | |||
| -variable naming policy from Fowler's refactoring book. | |||
| -tested against the PDC pre-beta of csc.exe; future versions will | |||
| -tested against the PDC pre-beta of csc.exe; future versions will | |||
| inevitably change things | |||
| */ | |||
| @@ -74,16 +74,15 @@ package org.apache.tools.ant.taskdefs.optional.dotnet; | |||
| import java.io.File; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.taskdefs.MatchingTask; | |||
| /** | |||
| Task to assemble .net 'Intermediate Language' files. | |||
| The task will only work on win2K until other platforms support csc.exe or | |||
| The task will only work on win2K until other platforms support csc.exe or | |||
| an equivalent. ilasm.exe must be on the execute path too. | |||
| <p> | |||
| @@ -95,95 +94,94 @@ even though the command line options are only vaguely | |||
| equivalent. [The low level commands take things like /OUT=file, | |||
| csc wants /out:file ... /verbose is used some places; /quiet here in | |||
| ildasm... etc.] It would be nice if someone made all the command line | |||
| tools consistent (and not as brittle as the java cmdline tools) | |||
| tools consistent (and not as brittle as the java cmdline tools) | |||
| <p> | |||
| The task is a directory based task, so attributes like <b>includes="*.il"</b> and | |||
| <b>excludes="broken.il"</b> can be used to control the files pulled in. | |||
| The task is a directory based task, so attributes like <b>includes="*.il"</b> and | |||
| <b>excludes="broken.il"</b> can be used to control the files pulled in. | |||
| Each file is built on its own, producing an appropriately named output file unless | |||
| manually specified with <b>outfile</b> | |||
| @author Steve Loughran steve_l@iseran.com | |||
| @version 0.2 | |||
| @author Steve Loughran steve_l@iseran.com | |||
| @version 0.2 | |||
| */ | |||
| public class Ilasm | |||
| extends org.apache.tools.ant.taskdefs.MatchingTask { | |||
| extends MatchingTask { | |||
| /** constructor inits everything and set up the search pattern | |||
| */ | |||
| public Ilasm () { | |||
| */ | |||
| public Ilasm() { | |||
| Clear(); | |||
| setIncludes(file_pattern); | |||
| } | |||
| /** name of the executable. the .exe suffix is deliberately not included | |||
| /** name of the executable. the .exe suffix is deliberately not included | |||
| * in anticipation of the unix version | |||
| */ | |||
| protected final static String exe_name="ilasm"; | |||
| protected final static String exe_name = "ilasm"; | |||
| /** what is the file extension we search on? | |||
| */ | |||
| protected final static String file_ext="il"; | |||
| /** and now derive the search pattern from the extension | |||
| protected final static String file_ext = "il"; | |||
| /** and now derive the search pattern from the extension | |||
| */ | |||
| protected final static String file_pattern="**/*."+file_ext; | |||
| protected final static String file_pattern = "**/*." + file_ext; | |||
| /** title of task for external presentation | |||
| */ | |||
| protected final static String exe_title="ilasm"; | |||
| /** reset all contents. | |||
| */ | |||
| protected final static String exe_title = "ilasm"; | |||
| /** reset all contents. | |||
| */ | |||
| public void Clear() { | |||
| _targetType=null; | |||
| _srcDir=null; | |||
| _targetType = null; | |||
| _srcDir = null; | |||
| _listing = false; | |||
| _verbose=false; | |||
| _debug=true; | |||
| _outputFile=null; | |||
| _failOnError=true; | |||
| _resourceFile=null; | |||
| _extraOptions=null; | |||
| _verbose = false; | |||
| _debug = true; | |||
| _outputFile = null; | |||
| _failOnError = true; | |||
| _resourceFile = null; | |||
| _extraOptions = null; | |||
| } | |||
| /** source directory upon which the search pattern is applied | |||
| */ | |||
| private File _srcDir; | |||
| /** | |||
| * Set the source dir to find the files to be compiled | |||
| * @param srcDirName The new SrcDir value | |||
| * @param srcDirName The new SrcDir value | |||
| */ | |||
| public void setSrcDir(File srcDirName){ | |||
| public void setSrcDir(File srcDirName) { | |||
| _srcDir = srcDirName; | |||
| } | |||
| /** type of target. Should be one of exe|library|module|winexe|(null) | |||
| default is exe; the actual value (if not null) is fed to the command line. | |||
| <br>See /target | |||
| default is exe; the actual value (if not null) is fed to the command line. | |||
| <br>See /target | |||
| */ | |||
| protected String _targetType; | |||
| /** define the target | |||
| * @param targetType one of exe|library| | |||
| * @exception BuildException if target is not one of exe|library|module|winexe | |||
| * @exception BuildException if target is not one of exe|library|module|winexe | |||
| */ | |||
| public void setTargetType(String targetType) | |||
| throws BuildException { | |||
| targetType=targetType.toLowerCase(); | |||
| if(targetType.equals("exe") || targetType.equals("library")) { | |||
| _targetType=targetType; | |||
| } | |||
| else { | |||
| throw new BuildException("targetType " +targetType+" is not a valid type"); | |||
| throws BuildException { | |||
| targetType = targetType.toLowerCase(); | |||
| if (targetType.equals("exe") || targetType.equals("library")) { | |||
| _targetType = targetType; | |||
| } else { | |||
| throw new BuildException("targetType " + targetType + " is not a valid type"); | |||
| } | |||
| } | |||
| @@ -191,97 +189,97 @@ public class Ilasm | |||
| * accessor method for target type | |||
| * @return the current target option | |||
| */ | |||
| public String getTargetType() { | |||
| public String getTargetType() { | |||
| return _targetType; | |||
| } | |||
| } | |||
| /** g | |||
| * get the target type or null for no argument needed | |||
| * get the target type or null for no argument needed | |||
| * | |||
| * @return The TargetTypeParameter value | |||
| */ | |||
| * @return The TargetTypeParameter value | |||
| */ | |||
| protected String getTargetTypeParameter() { | |||
| if(!notEmpty(_targetType)) { | |||
| if (!notEmpty(_targetType)) { | |||
| return null; | |||
| } | |||
| if (_targetType.equals("exe")) { | |||
| return "/exe"; | |||
| } else | |||
| if (_targetType.equals("library")) { | |||
| } else if (_targetType.equals("library")) { | |||
| return "/dll"; | |||
| } else { | |||
| return null; | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * Sets the Owner attribute | |||
| * Sets the Owner attribute | |||
| * | |||
| * @param s The new Owner value | |||
| * @param s The new Owner value | |||
| */ | |||
| public void setOwner(String s) { | |||
| log("This option is not supported by ILASM as of Beta-2, and will be ignored",Project.MSG_WARN); | |||
| } | |||
| log("This option is not supported by ILASM as of Beta-2, and will be ignored", Project.MSG_WARN); | |||
| } | |||
| /** test for a string containing something useful | |||
| * @param string to test | |||
| * @returns true if the argument is not null or empty | |||
| */ | |||
| protected boolean notEmpty(String s) | |||
| {return s!=null && s.length()!=0;} | |||
| */ | |||
| protected boolean notEmpty(String s) { | |||
| return s != null && s.length() != 0; | |||
| } | |||
| /** verbose flag | |||
| */ | |||
| protected boolean _verbose; | |||
| /** | |||
| /** | |||
| * enable/disable verbose ILASM output | |||
| * @param b flag set to true for verbose on | |||
| */ | |||
| public void setVerbose(boolean b) { | |||
| _verbose=b; | |||
| _verbose = b; | |||
| } | |||
| /** | |||
| /** | |||
| * turn the verbose flag into a parameter for ILASM | |||
| * @return null or the appropriate command line string | |||
| */ | |||
| protected String getVerboseParameter() { | |||
| return _verbose?null:"/quiet"; | |||
| } | |||
| } | |||
| /** listing flag | |||
| */ | |||
| protected boolean _listing; | |||
| /** | |||
| /** | |||
| * enable/disable listing | |||
| * @param b flag set to true for listing on | |||
| */ | |||
| public void setListing(boolean b) { | |||
| _listing=b; | |||
| _listing = b; | |||
| } | |||
| /** | |||
| /** | |||
| * turn the listing flag into a parameter for ILASM | |||
| * @return the appropriate string from the state of the listing flag | |||
| */ | |||
| protected String getListingParameter() { | |||
| return _listing?"/listing":"/nolisting"; | |||
| } | |||
| /** | |||
| * output file. If not supplied this is derived from the | |||
| * source file | |||
| */ | |||
| protected File _outputFile; | |||
| /** | |||
| * Set the definitions | |||
| * @param list of definitions split by ; or , or even : | |||
| @@ -289,164 +287,167 @@ public class Ilasm | |||
| public void setOutputFile(File params) { | |||
| _outputFile = params; | |||
| } | |||
| /** | |||
| * get the output file | |||
| * get the output file | |||
| * @return the argument string or null for no argument | |||
| */ | |||
| */ | |||
| protected String getOutputFileParameter() { | |||
| if (_outputFile==null || _outputFile.length()==0) { | |||
| if (_outputFile == null || _outputFile.length() == 0) { | |||
| return null; | |||
| } | |||
| File f = _outputFile; | |||
| return "/output="+f.toString(); | |||
| return "/output=" + f.toString(); | |||
| } | |||
| /** resource file (.res format) to include in the app. | |||
| /** resource file (.res format) to include in the app. | |||
| */ | |||
| protected File _resourceFile; | |||
| /** | |||
| * Set the resource file | |||
| * Set the resource file | |||
| * @param fileName path to the file. Can be relative, absolute, whatever. | |||
| */public void setResourceFile(File fileName) { | |||
| */ | |||
| public void setResourceFile(File fileName) { | |||
| _resourceFile = fileName; | |||
| } | |||
| protected String getResourceFileParameter() { | |||
| if(_resourceFile!=null) { | |||
| return "/resource="+_resourceFile.toString(); | |||
| } | |||
| else { | |||
| if (_resourceFile != null) { | |||
| return "/resource=" + _resourceFile.toString(); | |||
| } else { | |||
| return null; | |||
| } | |||
| } | |||
| /** flag to control action on execution trouble | |||
| */ | |||
| */ | |||
| protected boolean _failOnError; | |||
| /**set fail on error flag | |||
| */ | |||
| public void setFailOnError(boolean b){ | |||
| _failOnError=b; | |||
| */ | |||
| public void setFailOnError(boolean b) { | |||
| _failOnError = b; | |||
| } | |||
| /** query fail on error flag | |||
| */ | |||
| */ | |||
| public boolean getFailFailOnError() { | |||
| return _failOnError; | |||
| } | |||
| /** debug flag. Controls generation of debug information. | |||
| /** debug flag. Controls generation of debug information. | |||
| */ | |||
| protected boolean _debug; | |||
| /** set the debug flag on or off | |||
| * @param f on/off flag | |||
| */ | |||
| public void setDebug(boolean f) | |||
| {_debug=f;} | |||
| public void setDebug(boolean f) { | |||
| _debug = f; | |||
| } | |||
| /** query the debug flag | |||
| * @return true if debug is turned on | |||
| */ | |||
| public boolean getDebug() { | |||
| return _debug; | |||
| } | |||
| /** get the argument or null for no argument needed | |||
| */ | |||
| */ | |||
| protected String getDebugParameter() { | |||
| return _debug?"/debug":null; | |||
| } | |||
| } | |||
| /** file containing private key | |||
| */ | |||
| */ | |||
| private File _keyfile; | |||
| public void setKeyfile(File keyfile) { | |||
| this._keyfile=keyfile; | |||
| this._keyfile = keyfile; | |||
| } | |||
| /** get the argument or null for no argument needed | |||
| */ | |||
| */ | |||
| protected String getKeyfileParameter() { | |||
| if(_keyfile!=null) { | |||
| return "/keyfile:"+_keyfile.toString(); | |||
| if (_keyfile != null) { | |||
| return "/keyfile:" + _keyfile.toString(); | |||
| } else { | |||
| return null; | |||
| return null; | |||
| } | |||
| } | |||
| } | |||
| /** any extra command options? | |||
| */ | |||
| protected String _extraOptions; | |||
| /** | |||
| * Sets the ExtraOptions attribute | |||
| * | |||
| * @param extraOptions The new ExtraOptions value | |||
| * @param extraOptions The new ExtraOptions value | |||
| */ | |||
| public void setExtraOptions(String extraOptions) | |||
| {this._extraOptions=extraOptions;} | |||
| public void setExtraOptions(String extraOptions) { | |||
| this._extraOptions = extraOptions; | |||
| } | |||
| /** | |||
| * Gets the ExtraOptions attribute | |||
| * Gets the ExtraOptions attribute | |||
| * | |||
| * @return The ExtraOptions value | |||
| * @return The ExtraOptions value | |||
| */ | |||
| public String getExtraOptions() | |||
| {return this._extraOptions;} | |||
| public String getExtraOptions() { | |||
| return this._extraOptions; | |||
| } | |||
| /** | |||
| * get any extra options or null for no argument needed | |||
| * get any extra options or null for no argument needed | |||
| * | |||
| * @return The ExtraOptions Parameter to CSC | |||
| * @return The ExtraOptions Parameter to CSC | |||
| */ | |||
| protected String getExtraOptionsParameter() { | |||
| if (_extraOptions!=null && _extraOptions.length()!=0) { | |||
| if (_extraOptions != null && _extraOptions.length() != 0) { | |||
| return _extraOptions; | |||
| } else { | |||
| return null; | |||
| } | |||
| } | |||
| } | |||
| /** This is the execution entry point. Build a list of files and | |||
| * call ilasm on each of them. | |||
| * @throws BuildException if the assembly failed and FailOnError is true | |||
| */ | |||
| public void execute() | |||
| throws BuildException { | |||
| public void execute() | |||
| throws BuildException { | |||
| if (_srcDir == null) { | |||
| _srcDir=project.resolveFile("."); | |||
| _srcDir = project.resolveFile("."); | |||
| } | |||
| //get dependencies list. | |||
| //get dependencies list. | |||
| DirectoryScanner scanner = super.getDirectoryScanner(_srcDir); | |||
| String[] dependencies = scanner.getIncludedFiles(); | |||
| log("assembling "+dependencies.length+" file"+((dependencies.length==1)?"":"s")); | |||
| String baseDir=scanner.getBasedir().toString(); | |||
| log("assembling " + dependencies.length + " file" + ((dependencies.length == 1)?"":"s")); | |||
| String baseDir = scanner.getBasedir().toString(); | |||
| //add to the command | |||
| for (int i = 0; i < dependencies.length; i++) { | |||
| String targetFile=dependencies[i]; | |||
| targetFile=baseDir+File.separator+targetFile; | |||
| String targetFile = dependencies[i]; | |||
| targetFile = baseDir + File.separator + targetFile; | |||
| executeOneFile(targetFile); | |||
| } | |||
| } // end execute | |||
| /** | |||
| * do the work for one file by building the command line then calling it | |||
| * @param targetFile name of the the file to assemble | |||
| * @throws BuildException if the assembly failed and FailOnError is true | |||
| */ | |||
| public void executeOneFile(String targetFile) | |||
| throws BuildException { | |||
| NetCommand command=new NetCommand(this,exe_title,exe_name); | |||
| public void executeOneFile(String targetFile) | |||
| throws BuildException { | |||
| NetCommand command = new NetCommand(this, exe_title, exe_name); | |||
| command.setFailOnError(getFailFailOnError()); | |||
| //DEBUG helper | |||
| command.setTraceCommandLine(true); | |||
| @@ -454,18 +455,18 @@ public class Ilasm | |||
| command.addArgument(getDebugParameter()); | |||
| command.addArgument(getTargetTypeParameter()); | |||
| command.addArgument(getListingParameter()); | |||
| command.addArgument(getOutputFileParameter()); | |||
| command.addArgument(getOutputFileParameter()); | |||
| command.addArgument(getResourceFileParameter()); | |||
| command.addArgument(getVerboseParameter()); | |||
| command.addArgument(getKeyfileParameter()); | |||
| command.addArgument(getExtraOptionsParameter()); | |||
| /* space for more argumentativeness | |||
| command.addArgument(); | |||
| command.addArgument(); | |||
| */ | |||
| command.addArgument(targetFile); | |||
| //now run the command of exe + settings + file | |||
| command.runCommand(); | |||
| @@ -68,10 +68,9 @@ package org.apache.tools.ant.taskdefs.optional.dotnet; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.Execute; | |||
| import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; | |||
| import org.apache.tools.ant.taskdefs.LogStreamHandler; | |||
| @@ -79,136 +78,135 @@ import org.apache.tools.ant.types.Commandline; | |||
| /** | |||
| This is a helper class to spawn net commands out. | |||
| This is a helper class to spawn net commands out. | |||
| In its initial form it contains no .net specifics, just contains | |||
| all the command line/exe construction stuff. However, it may be handy in future | |||
| to have a means of setting the path to point to the dotnet bin directory; in which | |||
| case the shared code should go in here. | |||
| @author Steve Loughran steve_l@iseran.com | |||
| @created 2000-11-01 | |||
| @version 0.3 | |||
| @author Steve Loughran steve_l@iseran.com | |||
| @created 2000-11-01 | |||
| @version 0.3 | |||
| */ | |||
| public class NetCommand { | |||
| /** constructor | |||
| @param owning task | |||
| @param title (for logging/errors) | |||
| @param executable. Leave off the '.exe. for future portability | |||
| */ | |||
| @param owning task | |||
| @param title (for logging/errors) | |||
| @param executable. Leave off the '.exe. for future portability | |||
| */ | |||
| public NetCommand(Task owner, String title, String program) { | |||
| _owner=owner; | |||
| _title=title; | |||
| _program=program; | |||
| _commandLine=new Commandline(); | |||
| _owner = owner; | |||
| _title = title; | |||
| _program = program; | |||
| _commandLine = new Commandline(); | |||
| _commandLine.setExecutable(_program); | |||
| prepareExecutor(); | |||
| } | |||
| } | |||
| /** owner project | |||
| */ | |||
| protected Task _owner; | |||
| /** executabe | |||
| */ | |||
| protected Execute _exe; | |||
| /** what is the command line | |||
| */ | |||
| protected Commandline _commandLine; | |||
| /** title of the command | |||
| */ | |||
| protected String _title; | |||
| /** actual program to invoke | |||
| */ | |||
| protected String _program; | |||
| /** trace flag | |||
| */ | |||
| protected boolean _traceCommandLine=false; | |||
| protected boolean _traceCommandLine = false; | |||
| /** | |||
| * turn tracing on or off | |||
| * @param b trace flag | |||
| */ | |||
| public void setTraceCommandLine(boolean b){ | |||
| _traceCommandLine=b; | |||
| public void setTraceCommandLine(boolean b) { | |||
| _traceCommandLine = b; | |||
| } | |||
| /** flag to control action on execution trouble | |||
| */ | |||
| */ | |||
| protected boolean _failOnError; | |||
| /** | |||
| * set fail on error flag | |||
| * @param b fail flag -set to true to cause an exception to be raised if | |||
| * the return value != 0 | |||
| */ | |||
| public void setFailOnError(boolean b){ | |||
| _failOnError=b; | |||
| public void setFailOnError(boolean b) { | |||
| _failOnError = b; | |||
| } | |||
| /** query fail on error flag | |||
| */ | |||
| */ | |||
| public boolean getFailFailOnError() { | |||
| return _failOnError; | |||
| } | |||
| /** | |||
| /** | |||
| * verbose text log | |||
| * @param msg string to add to log iff verbose is defined for the build | |||
| */ | |||
| protected void logVerbose(String msg){ | |||
| _owner.getProject().log(msg,Project.MSG_VERBOSE); | |||
| } | |||
| protected void logVerbose(String msg) { | |||
| _owner.getProject().log(msg, Project.MSG_VERBOSE); | |||
| } | |||
| /** | |||
| * error text log | |||
| * @param msg message to display as an error | |||
| */ | |||
| protected void logError(String msg) { | |||
| _owner.getProject().log(msg,Project.MSG_ERR); | |||
| _owner.getProject().log(msg, Project.MSG_ERR); | |||
| } | |||
| /** | |||
| * add an argument to a command line; do nothing if the arg is null or empty string | |||
| * @param argument The feature to be added to the Argument attribute | |||
| * @param argument The feature to be added to the Argument attribute | |||
| */ | |||
| public void addArgument(String argument){ | |||
| if(argument!=null && argument.length()!=0) { | |||
| public void addArgument(String argument) { | |||
| if (argument != null && argument.length() != 0) { | |||
| _commandLine.createArgument().setValue(argument); | |||
| } | |||
| } | |||
| /** | |||
| * set up the command sequence.. | |||
| */ | |||
| protected void prepareExecutor() { | |||
| // default directory to the project's base directory | |||
| File dir = _owner.getProject().getBaseDir(); | |||
| ExecuteStreamHandler handler=new LogStreamHandler(_owner, | |||
| Project.MSG_INFO, Project.MSG_WARN); | |||
| ExecuteStreamHandler handler = new LogStreamHandler(_owner, | |||
| Project.MSG_INFO, Project.MSG_WARN); | |||
| _exe = new Execute(handler, null); | |||
| _exe.setAntRun(_owner.getProject()); | |||
| _exe.setWorkingDirectory(dir); | |||
| } | |||
| /** | |||
| * Run the command using the given Execute instance. | |||
| * @throws an exception of something goes wrong and the failOnError flag is true | |||
| */ | |||
| public void runCommand() | |||
| throws BuildException { | |||
| throws BuildException { | |||
| int err = -1; // assume the worst | |||
| try { | |||
| if(_traceCommandLine) { | |||
| if (_traceCommandLine) { | |||
| _owner.log(_commandLine.toString()); | |||
| } | |||
| else { | |||
| } else { | |||
| //in verbose mode we always log stuff | |||
| logVerbose(_commandLine.toString()); | |||
| } | |||
| @@ -216,13 +214,13 @@ public class NetCommand { | |||
| err = _exe.execute(); | |||
| if (err != 0) { | |||
| if (_failOnError) { | |||
| throw new BuildException(_title+" returned: "+err, _owner.getLocation()); | |||
| throw new BuildException(_title + " returned: " + err, _owner.getLocation()); | |||
| } else { | |||
| _owner.log(_title+" Result: " + err, Project.MSG_ERR); | |||
| _owner.log(_title + " Result: " + err, Project.MSG_ERR); | |||
| } | |||
| } | |||
| } catch (IOException e) { | |||
| throw new BuildException(_title+" failed: " + e, e, _owner.getLocation()); | |||
| throw new BuildException(_title + " failed: " + e, e, _owner.getLocation()); | |||
| } | |||
| } | |||
| } //class | |||
| @@ -65,6 +65,8 @@ import javax.xml.transform.TransformerFactory; | |||
| import javax.xml.transform.dom.DOMSource; | |||
| import javax.xml.transform.stream.StreamResult; | |||
| import org.w3c.dom.Document; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| @@ -73,7 +75,6 @@ import org.apache.tools.ant.taskdefs.LogStreamHandler; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| import org.apache.tools.ant.types.EnumeratedAttribute; | |||
| import org.apache.tools.ant.types.Path; | |||
| import org.w3c.dom.Document; | |||
| /** | |||
| @@ -131,7 +132,7 @@ public class CovReport extends Task { | |||
| /* | |||
| /** coverage home, mandatory */ | |||
| private File home = null; | |||
| private File home = null; | |||
| /** format of generated report, optional */ | |||
| private String format = null; | |||
| @@ -227,7 +228,7 @@ public class CovReport extends Task { | |||
| } | |||
| //@todo to remove | |||
| public Path createCoveragepath() { | |||
| public Path createCoveragepath() { | |||
| if (coveragePath == null) { | |||
| coveragePath = new Path(project); | |||
| } | |||
| @@ -77,7 +77,7 @@ public class Triggers { | |||
| } | |||
| // -jp_trigger=ClassName.*():E:S,ClassName.MethodName():X:X | |||
| public String toString() { | |||
| public String toString() { | |||
| StringBuffer buf = new StringBuffer(); | |||
| final int size = triggers.size(); | |||
| for (int i = 0; i < size; i++) { | |||
| @@ -119,7 +119,7 @@ public class Triggers { | |||
| } | |||
| // return <name>:<event>:<action>[:param] | |||
| public String toString() { | |||
| public String toString() { | |||
| StringBuffer buf = new StringBuffer(); | |||
| buf.append(name).append(":"); //@todo name must not be null, check for it | |||
| buf.append(eventMap.get(event)).append(":"); | |||
| @@ -62,17 +62,18 @@ import java.util.Vector; | |||
| import javax.xml.parsers.DocumentBuilder; | |||
| import javax.xml.parsers.DocumentBuilderFactory; | |||
| import org.w3c.dom.Document; | |||
| import org.w3c.dom.Element; | |||
| import org.w3c.dom.Node; | |||
| import org.w3c.dom.NodeList; | |||
| import org.xml.sax.InputSource; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassFile; | |||
| import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassPathLoader; | |||
| import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.MethodInfo; | |||
| import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.Utils; | |||
| import org.w3c.dom.Document; | |||
| import org.w3c.dom.Element; | |||
| import org.w3c.dom.Node; | |||
| import org.w3c.dom.NodeList; | |||
| import org.xml.sax.InputSource; | |||
| /** | |||
| * Little hack to process XML report from JProbe. It will fix | |||
| @@ -325,7 +326,7 @@ public class XMLReport { | |||
| Element classElem = report.createElement("class"); | |||
| classElem.setAttribute("name", classFile.getName()); | |||
| // source file possibly does not exist in the bytecode | |||
| if ( null != classFile.getSourceFile() ){ | |||
| if (null != classFile.getSourceFile()) { | |||
| classElem.setAttribute("source", classFile.getSourceFile()); | |||
| } | |||
| // create the cov.data elem | |||
| @@ -53,21 +53,21 @@ | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.io.BufferedInputStream; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.ByteArrayInputStream; | |||
| import java.io.FilenameFilter; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FilenameFilter; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.util.Enumeration; | |||
| import java.util.StringTokenizer; | |||
| import java.util.Vector; | |||
| import java.util.Hashtable; | |||
| import java.util.NoSuchElementException; | |||
| import java.util.zip.ZipFile; | |||
| import java.util.StringTokenizer; | |||
| import java.util.Vector; | |||
| import java.util.zip.ZipEntry; | |||
| import java.util.zip.ZipFile; | |||
| /** | |||
| * Core of the bytecode analyzer. It loads classes from a given classpath. | |||
| @@ -86,10 +86,10 @@ public class ClassPathLoader { | |||
| * separated by the platform specific path separator. | |||
| * @param classPath the classpath to load all the classes from. | |||
| */ | |||
| public ClassPathLoader(String classPath){ | |||
| public ClassPathLoader(String classPath) { | |||
| StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator); | |||
| Vector entries = new Vector(); | |||
| while (st.hasMoreTokens()){ | |||
| while (st.hasMoreTokens()) { | |||
| File file = new File(st.nextToken()); | |||
| entries.addElement(file); | |||
| } | |||
| @@ -101,9 +101,9 @@ public class ClassPathLoader { | |||
| * create a new instance with a given set of urls. | |||
| * @param entries valid file urls (either .jar, .zip or directory) | |||
| */ | |||
| public ClassPathLoader(String[] entries){ | |||
| public ClassPathLoader(String[] entries) { | |||
| files = new File[entries.length]; | |||
| for (int i = 0; i < entries.length; i++){ | |||
| for (int i = 0; i < entries.length; i++) { | |||
| files[i] = new File(entries[i]); | |||
| } | |||
| } | |||
| @@ -112,7 +112,7 @@ public class ClassPathLoader { | |||
| * create a new instance with a given set of urls | |||
| * @param entries file urls to look for classes (.jar, .zip or directory) | |||
| */ | |||
| public ClassPathLoader(File[] entries){ | |||
| public ClassPathLoader(File[] entries) { | |||
| files = entries; | |||
| } | |||
| @@ -120,6 +120,7 @@ public class ClassPathLoader { | |||
| public interface FileLoader { | |||
| /** the file url that is looked for .class files */ | |||
| public File getFile(); | |||
| /** return the set of classes found in the file */ | |||
| public ClassFile[] getClasses() throws IOException; | |||
| } | |||
| @@ -127,7 +128,7 @@ public class ClassPathLoader { | |||
| /** | |||
| * @return the set of <tt>FileLoader</tt> loaders matching the given classpath. | |||
| */ | |||
| public Enumeration loaders(){ | |||
| public Enumeration loaders() { | |||
| return new LoaderEnumeration(); | |||
| } | |||
| @@ -145,18 +146,18 @@ public class ClassPathLoader { | |||
| public Hashtable getClasses() throws IOException { | |||
| Hashtable map = new Hashtable(); | |||
| Enumeration enum = loaders(); | |||
| while ( enum.hasMoreElements() ){ | |||
| FileLoader loader = (FileLoader)enum.nextElement(); | |||
| while (enum.hasMoreElements()) { | |||
| FileLoader loader = (FileLoader) enum.nextElement(); | |||
| System.out.println("Processing " + loader.getFile()); | |||
| long t0 = System.currentTimeMillis(); | |||
| ClassFile[] classes = loader.getClasses(); | |||
| long dt = System.currentTimeMillis() - t0; | |||
| System.out.println("" + classes.length + " classes loaded in " + dt + "ms"); | |||
| for (int j = 0; j < classes.length; j++){ | |||
| for (int j = 0; j < classes.length; j++) { | |||
| String name = classes[j].getFullName(); | |||
| // do not allow duplicates entries to preserve 'classpath' behavior | |||
| // first class in wins | |||
| if ( !map.containsKey(name) ){ | |||
| if (!map.containsKey(name)) { | |||
| map.put(name, classes[j]); | |||
| } | |||
| } | |||
| @@ -167,21 +168,23 @@ public class ClassPathLoader { | |||
| /** the loader enumeration that will return loaders */ | |||
| protected class LoaderEnumeration implements Enumeration { | |||
| protected int index = 0; | |||
| public boolean hasMoreElements(){ | |||
| public boolean hasMoreElements() { | |||
| return index < files.length; | |||
| } | |||
| public Object nextElement(){ | |||
| if (index >= files.length){ | |||
| public Object nextElement() { | |||
| if (index >= files.length) { | |||
| throw new NoSuchElementException(); | |||
| } | |||
| File file = files[index++]; | |||
| if ( !file.exists() ){ | |||
| if (!file.exists()) { | |||
| return new NullLoader(file); | |||
| } | |||
| if ( file.isDirectory() ){ | |||
| if (file.isDirectory()) { | |||
| // it's a directory | |||
| return new DirectoryLoader(file); | |||
| } else if ( file.getName().endsWith(".zip") || file.getName().endsWith(".jar") ){ | |||
| } else if (file.getName().endsWith(".zip") || file.getName().endsWith(".jar")) { | |||
| // it's a jar/zip file | |||
| return new JarLoader(file); | |||
| } | |||
| @@ -212,15 +215,19 @@ public class ClassPathLoader { | |||
| /** a null loader to return when the file is not valid */ | |||
| class NullLoader implements ClassPathLoader.FileLoader { | |||
| private File file; | |||
| NullLoader(){ | |||
| NullLoader() { | |||
| this(null); | |||
| } | |||
| NullLoader(File file){ | |||
| NullLoader(File file) { | |||
| this.file = file; | |||
| } | |||
| public File getFile(){ | |||
| public File getFile() { | |||
| return file; | |||
| } | |||
| public ClassFile[] getClasses() throws IOException { | |||
| return new ClassFile[0]; | |||
| } | |||
| @@ -233,19 +240,22 @@ class NullLoader implements ClassPathLoader.FileLoader { | |||
| */ | |||
| class JarLoader implements ClassPathLoader.FileLoader { | |||
| private File file; | |||
| JarLoader(File file){ | |||
| JarLoader(File file) { | |||
| this.file = file; | |||
| } | |||
| public File getFile(){ | |||
| public File getFile() { | |||
| return file; | |||
| } | |||
| public ClassFile[] getClasses() throws IOException { | |||
| ZipFile zipFile = new ZipFile(file); | |||
| Vector v = new Vector(); | |||
| Enumeration entries = zipFile.entries(); | |||
| while (entries.hasMoreElements()){ | |||
| ZipEntry entry = (ZipEntry)entries.nextElement(); | |||
| if (entry.getName().endsWith(".class")){ | |||
| while (entries.hasMoreElements()) { | |||
| ZipEntry entry = (ZipEntry) entries.nextElement(); | |||
| if (entry.getName().endsWith(".class")) { | |||
| InputStream is = ClassPathLoader.getCachedStream(zipFile.getInputStream(entry)); | |||
| ClassFile classFile = new ClassFile(is); | |||
| is.close(); | |||
| @@ -266,17 +276,19 @@ class JarLoader implements ClassPathLoader.FileLoader { | |||
| class DirectoryLoader implements ClassPathLoader.FileLoader { | |||
| private File directory; | |||
| DirectoryLoader(File dir){ | |||
| DirectoryLoader(File dir) { | |||
| directory = dir; | |||
| } | |||
| public File getFile(){ | |||
| public File getFile() { | |||
| return directory; | |||
| } | |||
| public ClassFile[] getClasses() throws IOException { | |||
| Vector v = new Vector(); | |||
| Vector files = listFiles( directory, new ClassFilter(), true); | |||
| for (int i = 0; i < files.size(); i++){ | |||
| File file = (File)files.elementAt(i); | |||
| Vector files = listFiles(directory, new ClassFilter(), true); | |||
| for (int i = 0; i < files.size(); i++) { | |||
| File file = (File) files.elementAt(i); | |||
| InputStream is = null; | |||
| try { | |||
| is = ClassPathLoader.getCachedStream(new FileInputStream(file)); | |||
| @@ -285,10 +297,11 @@ class DirectoryLoader implements ClassPathLoader.FileLoader { | |||
| is = null; | |||
| v.addElement(classFile); | |||
| } finally { | |||
| if (is != null){ | |||
| if (is != null) { | |||
| try { | |||
| is.close(); | |||
| } catch (IOException ignored){} | |||
| } catch (IOException ignored) { | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -306,9 +319,9 @@ class DirectoryLoader implements ClassPathLoader.FileLoader { | |||
| * @return the list of <tt>File</tt> objects that applies to the given | |||
| * filter. | |||
| */ | |||
| public static Vector listFiles(File directory, FilenameFilter filter, boolean recurse){ | |||
| if (!directory.isDirectory()){ | |||
| throw new IllegalArgumentException(directory + " is not a directory"); | |||
| public static Vector listFiles(File directory, FilenameFilter filter, boolean recurse) { | |||
| if (!directory.isDirectory()) { | |||
| throw new IllegalArgumentException(directory + " is not a directory"); | |||
| } | |||
| Vector list = new Vector(); | |||
| listFilesTo(list, directory, filter, recurse); | |||
| @@ -324,15 +337,15 @@ class DirectoryLoader implements ClassPathLoader.FileLoader { | |||
| * @param recurse tells whether or not the listing is recursive. | |||
| * @return the list instance that was passed as the <tt>list</tt> argument. | |||
| */ | |||
| private static Vector listFilesTo(Vector list, File directory, FilenameFilter filter, boolean recurse){ | |||
| private static Vector listFilesTo(Vector list, File directory, FilenameFilter filter, boolean recurse) { | |||
| String[] files = directory.list(filter); | |||
| for (int i = 0; i < files.length; i++){ | |||
| list.addElement( new File(directory, files[i]) ); | |||
| for (int i = 0; i < files.length; i++) { | |||
| list.addElement(new File(directory, files[i])); | |||
| } | |||
| files = null; // we don't need it anymore | |||
| if (recurse){ | |||
| String[] subdirs = directory.list( new DirectoryFilter() ); | |||
| for (int i = 0; i < subdirs.length; i++){ | |||
| if (recurse) { | |||
| String[] subdirs = directory.list(new DirectoryFilter()); | |||
| for (int i = 0; i < subdirs.length; i++) { | |||
| listFilesTo(list, new File(directory, subdirs[i]), filter, recurse); | |||
| } | |||
| } | |||
| @@ -343,14 +356,15 @@ class DirectoryLoader implements ClassPathLoader.FileLoader { | |||
| /** Convenient filter that accepts only directory <tt>File</tt> */ | |||
| class DirectoryFilter implements FilenameFilter { | |||
| public boolean accept(File directory, String name){ | |||
| public boolean accept(File directory, String name) { | |||
| File pathname = new File(directory, name); | |||
| return pathname.isDirectory(); | |||
| } | |||
| } | |||
| /** convenient filter to accept only .class files */ | |||
| class ClassFilter implements FilenameFilter { | |||
| public boolean accept(File dir, String name){ | |||
| public boolean accept(File dir, String name) { | |||
| return name.endsWith(".class"); | |||
| } | |||
| } | |||
| @@ -78,7 +78,7 @@ public final class MethodInfo { | |||
| access_flags = dis.readShort(); | |||
| int name_index = dis.readShort(); | |||
| name = Utils.getUTF8Value(constantPool, name_index); | |||
| name = Utils.getUTF8Value(constantPool, name_index); | |||
| int descriptor_index = dis.readShort(); | |||
| descriptor = Utils.getUTF8Value(constantPool, descriptor_index); | |||
| @@ -99,7 +99,7 @@ public final class MethodInfo { | |||
| protected void readCode(ConstantPool constantPool, DataInputStream dis) throws IOException { | |||
| // skip max_stack (short), max_local (short) | |||
| dis.skipBytes(2*2); | |||
| dis.skipBytes(2 * 2); | |||
| // skip bytecode... | |||
| int bytecode_len = dis.readInt(); | |||
| @@ -54,9 +54,10 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; | |||
| import java.util.Vector; | |||
| import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPool; | |||
| import org.apache.tools.ant.taskdefs.optional.depend.constantpool.Utf8CPInfo; | |||
| import java.util.Vector; | |||
| /** | |||
| * Utilities mostly to manipulate methods and access flags. | |||
| @@ -92,7 +93,7 @@ public class Utils { | |||
| public final static short ACC_STRICT = 2048; | |||
| /** private constructor */ | |||
| private Utils(){ | |||
| private Utils() { | |||
| } | |||
| /** | |||
| @@ -102,8 +103,8 @@ public class Utils { | |||
| * @return the value of the string if it exists | |||
| * @throws ClassCastException if the index is not an UTF8 constant. | |||
| */ | |||
| public static String getUTF8Value(ConstantPool pool, int index){ | |||
| return ((Utf8CPInfo)pool.getEntry(index)).getValue(); | |||
| public static String getUTF8Value(ConstantPool pool, int index) { | |||
| return ((Utf8CPInfo) pool.getEntry(index)).getValue(); | |||
| } | |||
| /** | |||
| @@ -113,18 +114,18 @@ public class Utils { | |||
| * represent a java object with its fully qualified classname or the | |||
| * primitive name such as int, long, ... | |||
| */ | |||
| public static String[] getMethodParams(String descriptor){ | |||
| public static String[] getMethodParams(String descriptor) { | |||
| int i = 0; | |||
| if (descriptor.charAt(i) != '('){ | |||
| if (descriptor.charAt(i) != '(') { | |||
| throw new IllegalArgumentException("Method descriptor should start with a '('"); | |||
| } | |||
| Vector params = new Vector(); | |||
| StringBuffer param = new StringBuffer(); | |||
| i++; | |||
| while ( (i = descriptor2java(descriptor, i, param)) < descriptor.length() ){ | |||
| while ((i = descriptor2java(descriptor, i, param)) < descriptor.length()) { | |||
| params.add(param.toString()); | |||
| param.setLength(0); // reset | |||
| if (descriptor.charAt(i) == ')'){ | |||
| if (descriptor.charAt(i) == ')') { | |||
| i++; | |||
| break; | |||
| } | |||
| @@ -139,7 +140,7 @@ public class Utils { | |||
| * @param descriptor | |||
| * @return get the return type objet of a given descriptor | |||
| */ | |||
| public static String getMethodReturnType(String descriptor){ | |||
| public static String getMethodReturnType(String descriptor) { | |||
| int pos = descriptor.indexOf(')'); | |||
| StringBuffer rettype = new StringBuffer(); | |||
| descriptor2java(descriptor, pos + 1, rettype); | |||
| @@ -153,23 +154,41 @@ public class Utils { | |||
| * @param sb the stringbuffer to return the java equivalent of the symbol | |||
| * @return the index after the descriptor symbol | |||
| */ | |||
| public static int descriptor2java(String descriptor, int i, StringBuffer sb){ | |||
| public static int descriptor2java(String descriptor, int i, StringBuffer sb) { | |||
| // get the dimension | |||
| StringBuffer dim = new StringBuffer(); | |||
| for (;descriptor.charAt(i) == '['; i++){ | |||
| for (; descriptor.charAt(i) == '['; i++) { | |||
| dim.append("[]"); | |||
| } | |||
| // now get the type | |||
| switch (descriptor.charAt(i)){ | |||
| case 'B': sb.append("byte"); break; | |||
| case 'C': sb.append("char"); break; | |||
| case 'D': sb.append("double"); break; | |||
| case 'F': sb.append("float"); break; | |||
| case 'I': sb.append("int"); break; | |||
| case 'J': sb.append("long"); break; | |||
| case 'S': sb.append("short"); break; | |||
| case 'Z': sb.append("boolean"); break; | |||
| case 'V': sb.append("void"); break; | |||
| switch (descriptor.charAt(i)) { | |||
| case 'B': | |||
| sb.append("byte"); | |||
| break; | |||
| case 'C': | |||
| sb.append("char"); | |||
| break; | |||
| case 'D': | |||
| sb.append("double"); | |||
| break; | |||
| case 'F': | |||
| sb.append("float"); | |||
| break; | |||
| case 'I': | |||
| sb.append("int"); | |||
| break; | |||
| case 'J': | |||
| sb.append("long"); | |||
| break; | |||
| case 'S': | |||
| sb.append("short"); | |||
| break; | |||
| case 'Z': | |||
| sb.append("boolean"); | |||
| break; | |||
| case 'V': | |||
| sb.append("void"); | |||
| break; | |||
| case 'L': | |||
| // it is a class | |||
| int pos = descriptor.indexOf(';', i + 1); | |||
| @@ -196,6 +215,7 @@ public class Utils { | |||
| public static boolean isAbstract(int access_flags) { | |||
| return (access_flags & ACC_ABSTRACT) != 0; | |||
| } | |||
| /** | |||
| * check for public access | |||
| * @param access_flags access flags | |||
| @@ -203,6 +223,7 @@ public class Utils { | |||
| public static boolean isPublic(int access_flags) { | |||
| return (access_flags & ACC_PUBLIC) != 0; | |||
| } | |||
| /** | |||
| * check for a static access | |||
| * @param access_flags access flags | |||
| @@ -210,6 +231,7 @@ public class Utils { | |||
| public static boolean isStatic(int access_flags) { | |||
| return (access_flags & ACC_STATIC) != 0; | |||
| } | |||
| /** | |||
| * check for native access | |||
| * @param access_flags access flags | |||
| @@ -217,6 +239,7 @@ public class Utils { | |||
| public static boolean isNative(int access_flags) { | |||
| return (access_flags & ACC_NATIVE) != 0; | |||
| } | |||
| /** | |||
| * check for class access | |||
| * @param access_flags access flags | |||
| @@ -224,6 +247,7 @@ public class Utils { | |||
| public static boolean isClass(int access_flags) { | |||
| return !isInterface(access_flags); | |||
| } | |||
| /** | |||
| * check for strict access | |||
| * @param access_flags access flags | |||
| @@ -231,6 +255,7 @@ public class Utils { | |||
| public static boolean isStrict(int access_flags) { | |||
| return (access_flags & ACC_STRICT) != 0; | |||
| } | |||
| /** | |||
| * check for interface access | |||
| * @param access_flags access flags | |||
| @@ -238,6 +263,7 @@ public class Utils { | |||
| public static boolean isInterface(int access_flags) { | |||
| return (access_flags & ACC_INTERFACE) != 0; | |||
| } | |||
| /** | |||
| * check for private access | |||
| * @param access_flags access flags | |||
| @@ -245,6 +271,7 @@ public class Utils { | |||
| public static boolean isPrivate(int access_flags) { | |||
| return (access_flags & ACC_PRIVATE) != 0; | |||
| } | |||
| /** | |||
| * check for transient flag | |||
| * @param access_flags access flags | |||
| @@ -252,13 +279,15 @@ public class Utils { | |||
| public static boolean isTransient(int access_flags) { | |||
| return (access_flags & ACC_TRANSIENT) != 0; | |||
| } | |||
| /** | |||
| * check for volatile flag | |||
| * @param access_flags access flags | |||
| */ | |||
| public static boolean isVolatile(int access_flags){ | |||
| public static boolean isVolatile(int access_flags) { | |||
| return (access_flags & ACC_VOLATILE) != 0; | |||
| } | |||
| /** | |||
| * check for super flag | |||
| * @param access_flags access flag | |||
| @@ -266,6 +295,7 @@ public class Utils { | |||
| public static boolean isSuper(int access_flags) { | |||
| return (access_flags & ACC_SUPER) != 0; | |||
| } | |||
| /** | |||
| * check for protected flag | |||
| * @param access_flags access flags | |||
| @@ -273,6 +303,7 @@ public class Utils { | |||
| public static boolean isProtected(int access_flags) { | |||
| return (access_flags & ACC_PROTECTED) != 0; | |||
| } | |||
| /** | |||
| * chck for final flag | |||
| * @param access_flags access flags | |||
| @@ -280,6 +311,7 @@ public class Utils { | |||
| public static boolean isFinal(int access_flags) { | |||
| return (access_flags & ACC_FINAL) != 0; | |||
| } | |||
| /** | |||
| * check for synchronized flag | |||
| * @param access_flags access flags | |||
| @@ -295,26 +327,26 @@ public class Utils { | |||
| */ | |||
| public static String getMethodAccess(int access_flags) { | |||
| StringBuffer sb = new StringBuffer(); | |||
| if(isPublic(access_flags)){ | |||
| if (isPublic(access_flags)) { | |||
| sb.append("public "); | |||
| } else if(isPrivate(access_flags)){ | |||
| } else if (isPrivate(access_flags)) { | |||
| sb.append("private "); | |||
| } else if(isProtected(access_flags)){ | |||
| } else if (isProtected(access_flags)) { | |||
| sb.append("protected "); | |||
| } | |||
| if(isFinal(access_flags)){ | |||
| if (isFinal(access_flags)) { | |||
| sb.append("final "); | |||
| } | |||
| if(isStatic(access_flags)){ | |||
| if (isStatic(access_flags)) { | |||
| sb.append("static "); | |||
| } | |||
| if(isSynchronized(access_flags)){ | |||
| if (isSynchronized(access_flags)) { | |||
| sb.append("synchronized "); | |||
| } | |||
| if(isNative(access_flags)){ | |||
| if (isNative(access_flags)) { | |||
| sb.append("native "); | |||
| } | |||
| if(isAbstract(access_flags)){ | |||
| if (isAbstract(access_flags)) { | |||
| sb.append("abstract "); | |||
| } | |||
| return sb.toString().trim(); | |||
| @@ -327,23 +359,23 @@ public class Utils { | |||
| */ | |||
| public static String getFieldAccess(int access_flags) { | |||
| StringBuffer sb = new StringBuffer(); | |||
| if(isPublic(access_flags)){ | |||
| if (isPublic(access_flags)) { | |||
| sb.append("public "); | |||
| } else if(isPrivate(access_flags)){ | |||
| } else if (isPrivate(access_flags)) { | |||
| sb.append("private "); | |||
| } else if (isProtected(access_flags)){ | |||
| } else if (isProtected(access_flags)) { | |||
| sb.append("protected "); | |||
| } | |||
| if(isFinal(access_flags)){ | |||
| if (isFinal(access_flags)) { | |||
| sb.append("final "); | |||
| } | |||
| if(isStatic(access_flags)){ | |||
| if (isStatic(access_flags)) { | |||
| sb.append("static "); | |||
| } | |||
| if(isVolatile(access_flags)){ | |||
| if (isVolatile(access_flags)) { | |||
| sb.append("volatile "); | |||
| } | |||
| if(isTransient(access_flags)){ | |||
| if (isTransient(access_flags)) { | |||
| sb.append("transient "); | |||
| } | |||
| return sb.toString().trim(); | |||
| @@ -356,26 +388,26 @@ public class Utils { | |||
| */ | |||
| public static String getClassAccess(int access_flags) { | |||
| StringBuffer sb = new StringBuffer(); | |||
| if(isPublic(access_flags)){ | |||
| if (isPublic(access_flags)) { | |||
| sb.append("public "); | |||
| } else if (isProtected(access_flags)){ | |||
| } else if (isProtected(access_flags)) { | |||
| sb.append("protected "); | |||
| } else if (isPrivate(access_flags)){ | |||
| } else if (isPrivate(access_flags)) { | |||
| sb.append("private "); | |||
| } | |||
| if(isFinal(access_flags)){ | |||
| if (isFinal(access_flags)) { | |||
| sb.append("final "); | |||
| } | |||
| if(isSuper(access_flags)){ | |||
| if (isSuper(access_flags)) { | |||
| sb.append("/*super*/ "); | |||
| } | |||
| if(isInterface(access_flags)){ | |||
| if (isInterface(access_flags)) { | |||
| sb.append("interface "); | |||
| } | |||
| if(isAbstract(access_flags)){ | |||
| if (isAbstract(access_flags)) { | |||
| sb.append("abstract "); | |||
| } | |||
| if(isClass(access_flags)){ | |||
| if (isClass(access_flags)) { | |||
| sb.append("class "); | |||
| } | |||
| return sb.toString().trim(); | |||