clirr-devel Mailing List for Clirr (Page 34)
Status: Alpha
Brought to you by:
lkuehne
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(23) |
Nov
|
Dec
(25) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(9) |
Feb
|
Mar
|
Apr
|
May
(76) |
Jun
(207) |
Jul
(242) |
Aug
(42) |
Sep
(33) |
Oct
|
Nov
(7) |
Dec
(1) |
2005 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(66) |
Sep
(38) |
Oct
(6) |
Nov
|
Dec
(2) |
2006 |
Jan
(17) |
Feb
(5) |
Mar
(28) |
Apr
(6) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(7) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(33) |
Jun
(4) |
Jul
(3) |
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2008 |
Jan
(4) |
Feb
(3) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
(5) |
Oct
(20) |
Nov
(7) |
Dec
(9) |
2009 |
Jan
(8) |
Feb
(3) |
Mar
(20) |
Apr
(10) |
May
(40) |
Jun
(11) |
Jul
(23) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(2) |
2010 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
(6) |
May
(22) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(2) |
2014 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <lk...@us...> - 2004-06-13 11:43:04
|
Update of /cvsroot/clirr/clirr/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23758 Modified Files: changes.xml Log Message: Removed abstract methods that are specified by an implemented interface are no longer reported as a compatibility problem. (RFE #961229) Index: changes.xml =================================================================== RCS file: /cvsroot/clirr/clirr/xdocs/changes.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- changes.xml 11 Jun 2004 03:52:24 -0000 1.11 +++ changes.xml 13 Jun 2004 11:42:54 -0000 1.12 @@ -27,6 +27,11 @@ for running checks and generating reports from the command-line. </action> + <action dev="lkuehne" type="fix"> + <!-- RFE #961229--> + Removed abstract methods that are specified by an implemented interface + are no longer reported as a compatibility problem. + </action> </release> <release version="0.3" date="2004-05-23"> |
From: Simon K. <si...@ec...> - 2004-06-13 11:23:01
|
Hi Lars, Thanks for all the code prettifying :-). I'll try to run "maven checkstyle" before doing future checkins. Is there an option somewhere to automatically fix checkstyle problems (he asks hopefully)? And by the way, as you are obviously online right now, is there an IRC channel we can chat on? Regards, Simon |
From: <lk...@us...> - 2004-06-13 11:01:08
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12977/framework Modified Files: CheckerException.java ClassSelector.java Log Message: fixed checkstyle errors Index: CheckerException.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework/CheckerException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CheckerException.java 11 Jun 2004 00:02:21 -0000 1.1 +++ CheckerException.java 13 Jun 2004 11:00:59 -0000 1.2 @@ -25,7 +25,7 @@ * <p> * The Clirr coding conventions use checked exceptions (such as this one) * for errors whose cause is something external to the clirr library/app. - * Unchecked exceptions are used for errors that are due to bugs within + * Unchecked exceptions are used for errors that are due to bugs within * clirr code (assertion-violation type problems). */ public class CheckerException extends Exception @@ -34,7 +34,7 @@ { super(msg); } - + public CheckerException(String msg, Throwable t) { super(msg, t); Index: ClassSelector.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework/ClassSelector.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ClassSelector.java 11 Jun 2004 00:38:29 -0000 1.2 +++ ClassSelector.java 13 Jun 2004 11:00:59 -0000 1.3 @@ -103,7 +103,7 @@ { return false; } - + boolean matches = matchesCriteria(clazz); if (mode == MODE_IF) { @@ -128,20 +128,20 @@ { return false; } - - for(int i=dollarPos+1; i<name.length(); ++i) + + for (int i = dollarPos + 1; i < name.length(); ++i) { if (!Character.isDigit(name.charAt(i))) { return false; } } - + // ok, we have a class name which contains a dollar sign, and // every subsequent character is a digit. return true; } - + /** * Return true if this class matches one of the criteria stored * in this object. |
From: <lk...@us...> - 2004-06-13 11:01:08
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/checks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12977/checks Modified Files: MethodSetCheck.java Log Message: fixed checkstyle errors Index: MethodSetCheck.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/checks/MethodSetCheck.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- MethodSetCheck.java 8 Jun 2004 09:10:00 -0000 1.7 +++ MethodSetCheck.java 13 Jun 2004 11:00:59 -0000 1.8 @@ -357,7 +357,7 @@ { boolean bIsDeprecated = isDeprecated(baselineMethod); boolean cIsDeprecated = isDeprecated(currentMethod); - + if (bIsDeprecated && !cIsDeprecated) { fireDiff( @@ -434,14 +434,14 @@ private boolean isDeprecated(Method method) { Attribute[] attrs = method.getAttributes(); - for(int i=0; i<attrs.length; ++i) + for (int i = 0; i < attrs.length; ++i) { if (attrs[i] instanceof org.apache.bcel.classfile.Deprecated) { return true; } } - + return false; } } |
From: <lk...@us...> - 2004-06-13 11:01:07
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12977 Modified Files: Checker.java Log Message: fixed checkstyle errors Index: Checker.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/Checker.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Checker.java 11 Jun 2004 00:37:37 -0000 1.13 +++ Checker.java 13 Jun 2004 11:00:59 -0000 1.14 @@ -252,7 +252,7 @@ private static JavaClass extractClass( ZipEntry zipEntry, ZipFile zip, Repository repository) - throws CheckerException + throws CheckerException { String name = zipEntry.getName(); InputStream is = null; |
From: <lk...@us...> - 2004-06-13 10:44:34
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/ant In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29010 Modified Files: AntTask.java Log Message: fixed checkstyle error Index: AntTask.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/ant/AntTask.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- AntTask.java 11 Jun 2004 00:03:21 -0000 1.11 +++ AntTask.java 13 Jun 2004 10:44:25 -0000 1.12 @@ -248,7 +248,7 @@ { checker.reportDiffs(origJars, newJars, origThirdPartyLoader, newThirdPartyLoader, null); } - catch(CheckerException ex) + catch (CheckerException ex) { throw new BuildException(ex.getMessage()); } |
From: <lk...@us...> - 2004-06-13 10:43:31
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27831 Modified Files: CoIterator.java Log Message: Made CoIterator class final to tighten the API. Index: CoIterator.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework/CoIterator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CoIterator.java 13 Jun 2004 09:46:08 -0000 1.2 +++ CoIterator.java 13 Jun 2004 10:43:20 -0000 1.3 @@ -25,8 +25,8 @@ import java.util.NoSuchElementException; /** - * This is an iterator that walks a pair of collections, returning - * matching pairs from the set. + * This is an iterator that walks a pair of collections, returning + * matching pairs from the set. * <p> * When an element is present in the left set but there is no equal object * in the right set, the pair (leftobj, null) is returned. @@ -49,17 +49,17 @@ * @author Simon Kitching. */ -public class CoIterator +public final class CoIterator { private Object[] left; private Object[] right; - + private int leftIndex; private int rightIndex; - + private Object currLeft; private Object currRight; - + private Comparator comparator; /** @@ -76,7 +76,7 @@ this.comparator = comparator; this.left = left.toArray(); this.right = right.toArray(); - + Arrays.sort(this.left, comparator); Arrays.sort(this.right, comparator); } @@ -97,7 +97,7 @@ this.comparator = comparator; this.left = (Object[]) left.clone(); this.right = (Object[]) right.clone(); - + Arrays.sort(this.left, comparator); Arrays.sort(this.right, comparator); } @@ -109,7 +109,7 @@ { return (leftIndex < left.length) || (rightIndex < right.length); } - + /** * Moves this iterator object to refer to the next "pair" of objects. * <p> @@ -124,16 +124,16 @@ { boolean haveLeft = leftIndex < left.length; boolean haveRight = rightIndex < right.length; - + if (!haveLeft && !haveRight) { currLeft = null; currRight = null; throw new NoSuchElementException(); } - + int order; - + if (haveLeft && !haveRight) { order = -1; @@ -151,8 +151,8 @@ Comparable c1 = (Comparable) left[leftIndex]; order = c1.compareTo(right[rightIndex]); } - - if (order < 0) + + if (order < 0) { currLeft = left[leftIndex]; currRight = null; @@ -172,11 +172,11 @@ ++rightIndex; } } - + /** * Return an object from the "left" collection specified to this object's * constructor. When the iterator has selected an element in the "right" - * collection for which there is no corresponding element in the left + * collection for which there is no corresponding element in the left * collection, then this will return null. */ public Object getLeft() |
From: <lk...@us...> - 2004-06-13 10:39:20
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23835 Modified Files: JavaClassNameComparator.java Log Message: made JavaClassNameComparator a singleton fixed checkstyle errors Index: JavaClassNameComparator.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework/JavaClassNameComparator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JavaClassNameComparator.java 13 Jun 2004 09:27:10 -0000 1.1 +++ JavaClassNameComparator.java 13 Jun 2004 10:39:09 -0000 1.2 @@ -25,17 +25,32 @@ /** * A class which specifies that JavaClass instances are ordered * by string comparisons of their names. + * + * @author Simon Kitching */ -public class JavaClassNameComparator implements Comparator +public final class JavaClassNameComparator implements Comparator { - public static final JavaClassNameComparator COMPARATOR = + /** + * A JavaClassNameComparator does not carry any state, + * so only this singleton instance should be used. + */ + public static final JavaClassNameComparator COMPARATOR = new JavaClassNameComparator(); - + + /** + * Prevents external instantiation. + * Clients should use {@link #COMPARATOR} exclusively. + */ + private JavaClassNameComparator() + { + } + + /** @see Comparator#compare */ public int compare(Object o1, Object o2) { - String n1 = ((JavaClass)o1).getClassName(); - String n2 = ((JavaClass)o2).getClassName(); + String n1 = ((JavaClass) o1).getClassName(); + String n2 = ((JavaClass) o2).getClassName(); return n1.compareTo(n2); } } |
From: <lk...@us...> - 2004-06-13 10:29:16
|
Update of /cvsroot/clirr/clirr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15090 Modified Files: project.xml Log Message: added Simon to the developer list Index: project.xml =================================================================== RCS file: /cvsroot/clirr/clirr/project.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- project.xml 10 Jun 2004 23:56:49 -0000 1.20 +++ project.xml 13 Jun 2004 10:29:07 -0000 1.21 @@ -104,7 +104,6 @@ <developer> <name>Vincent Massol</name> <id>vmassol</id> - <email></email> <organization>Apache Software Foundation</organization> <timezone>+1</timezone> <url>http://blogs.codehaus.org/people/vmassol</url> @@ -114,6 +113,15 @@ <role>Maven Guru</role> </roles> </developer> + <developer> + <name>Simon Kitching</name> + <id>s_kitching</id> + <organization>ECN</organization> + <timezone>+12</timezone> + <roles> + <role>Java Developer</role> + </roles> + </developer> </developers> |
From: <lk...@us...> - 2004-06-13 10:26:12
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/cli In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12592 Modified Files: Clirr.java Log Message: cleanup - remove unused imports - avoid unused variable showAll - trailing spaces, brace position and indentation Index: Clirr.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/cli/Clirr.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Clirr.java 11 Jun 2004 00:03:49 -0000 1.1 +++ Clirr.java 13 Jun 2004 10:26:02 -0000 1.2 @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // Clirr: compares two versions of a java library for binary compatibility -// Copyright (C) 2003 - 2004 Lars K?hne +// Copyright (C) 2003 - 2004 Lars Kühne // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,119 +19,115 @@ package net.sf.clirr.cli; +import net.sf.clirr.Checker; +import net.sf.clirr.event.DiffListener; +import net.sf.clirr.event.PlainDiffListener; +import net.sf.clirr.event.XmlDiffListener; +import net.sf.clirr.framework.CheckerException; +import net.sf.clirr.framework.ClassSelector; import org.apache.commons.cli.BasicParser; import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Options; import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import java.io.File; -import java.io.PrintWriter; import java.io.IOException; - -import java.util.Arrays; -import java.util.ArrayList; +import java.io.PrintWriter; import java.net.URL; -import java.net.MalformedURLException; import java.net.URLClassLoader; - -import net.sf.clirr.Checker; -import net.sf.clirr.event.DiffListener; -import net.sf.clirr.event.PlainDiffListener; -import net.sf.clirr.event.XmlDiffListener; -import net.sf.clirr.event.ScopeSelector; -import net.sf.clirr.framework.ClassSelector; -import net.sf.clirr.framework.CheckerException; +import java.util.ArrayList; /** * Commandline interface for generating a difference report or checking * for binary compatibility between two versions of the same application. */ - public class Clirr { +public class Clirr +{ + + private static final File[] EMPTY_FILE_ARRAY = new File[]{}; - private static final File[] EMPTY_FILE_ARRAY = new File[]{}; - // =================================================================== - - public static void main(String[] args) - { - new Clirr().run(args); - } - - // =================================================================== - - private void run(String[] args) - { + + public static void main(String[] args) + { + new Clirr().run(args); + } + + // =================================================================== + + private void run(String[] args) + { System.out.println("reporting diffs.."); - BasicParser parser = new BasicParser(); - Options options = new Options(); - options.addOption("o", "oldversion", true, "jar files of old version"); - options.addOption("n", "newversion", true, "jar files of new version"); - options.addOption("s", "style", true, "output style"); - options.addOption("a", "show-all-scopes", false, "show private and package classes"); - options.addOption("f", "output-file", true, "output file name"); - - CommandLine cmdline = null; - try - { - cmdline = parser.parse(options, args); - } - catch(ParseException ex) - { - System.err.println("Invalid command line arguments."); - usage(options); - System.exit(-1); - } - - // TODO: provide commandline options that allow the user to - // specify which packages/classes should be checked - // - ClassSelector classSelector = new ClassSelector(ClassSelector.MODE_UNLESS); - - String oldPath = cmdline.getOptionValue('o'); - String newPath = cmdline.getOptionValue('n'); - String style = cmdline.getOptionValue('s', "text"); - String outputFileName = cmdline.getOptionValue('f'); - boolean showAll = cmdline.hasOption('a'); - - if ((oldPath == null) || (newPath == null)) - { - usage(options); - System.exit(-1); - } - + BasicParser parser = new BasicParser(); + Options options = new Options(); + options.addOption("o", "oldversion", true, "jar files of old version"); + options.addOption("n", "newversion", true, "jar files of new version"); + options.addOption("s", "style", true, "output style"); + options.addOption("a", "show-all-scopes", false, "show private and package classes"); + options.addOption("f", "output-file", true, "output file name"); + + CommandLine cmdline = null; + try + { + cmdline = parser.parse(options, args); + } + catch (ParseException ex) + { + System.err.println("Invalid command line arguments."); + usage(options); + System.exit(-1); + } + + // TODO: provide commandline options that allow the user to + // specify which packages/classes should be checked + // + ClassSelector classSelector = new ClassSelector(ClassSelector.MODE_UNLESS); + + String oldPath = cmdline.getOptionValue('o'); + String newPath = cmdline.getOptionValue('n'); + String style = cmdline.getOptionValue('s', "text"); + String outputFileName = cmdline.getOptionValue('f'); + boolean showAll = cmdline.hasOption('a'); + + if ((oldPath == null) || (newPath == null)) + { + usage(options); + System.exit(-1); + } + Checker checker = new Checker(); - if (cmdline.hasOption('a')) + if (showAll) { - checker.getScopeSelector().selectPrivate(true); - checker.getScopeSelector().selectPackage(true); + checker.getScopeSelector().selectPrivate(true); + checker.getScopeSelector().selectPackage(true); } - - DiffListener diffListener = null; - if (style.equals("text")) + + DiffListener diffListener = null; + if (style.equals("text")) { try { diffListener = new PlainDiffListener(outputFileName); } - catch(IOException ex) + catch (IOException ex) { System.err.println("Invalid output file name."); } - } - else if (style.equals("xml")) + } + else if (style.equals("xml")) { try { diffListener = new XmlDiffListener(outputFileName); } - catch(IOException ex) + catch (IOException ex) { System.err.println("Invalid output file name."); } - } - else + } + else { System.err.println("Invalid style option. Must be one of 'text', 'xml'."); usage(options); @@ -140,51 +136,50 @@ File[] origJars = pathToFileArray(oldPath); File[] newJars = pathToFileArray(newPath); - - ClassLoader loader1 = new URLClassLoader(new URL[] {}); - ClassLoader loader2 = new URLClassLoader(new URL[] {}); + + ClassLoader loader1 = new URLClassLoader(new URL[]{}); + ClassLoader loader2 = new URLClassLoader(new URL[]{}); checker.addDiffListener(diffListener); - + try { checker.reportDiffs(origJars, newJars, loader1, loader2, classSelector); } - catch(CheckerException ex) + catch (CheckerException ex) { System.err.println("Unable to complete checks:" + ex.getMessage()); System.exit(1); } - } - - private void usage(Options options) - { - HelpFormatter hf = new HelpFormatter(); - PrintWriter out = new PrintWriter(System.err); - hf.printHelp( - 75, - "java net.sf.clirr.cmdline.CheckRunner -o path -n path [options]", - null, options, null); - } - - private File[] pathToFileArray(String path) - { - ArrayList files = new ArrayList(); - - int pos = 0; - while (pos < path.length()) - { - int colonPos = path.indexOf(pos, ':'); - if (colonPos == -1) - { - files.add(new File(path.substring(pos))); - break; - } - - files.add(new File(path.substring(pos, colonPos))); - pos = colonPos + 1; - } - - return (File[]) files.toArray(EMPTY_FILE_ARRAY); - } -} \ No newline at end of file + } + + private void usage(Options options) + { + HelpFormatter hf = new HelpFormatter(); + PrintWriter out = new PrintWriter(System.err); + hf.printHelp(75, + "java " + getClass().getName() + " -o path -n path [options]", + null, options, null); + } + + private File[] pathToFileArray(String path) + { + ArrayList files = new ArrayList(); + + int pos = 0; + while (pos < path.length()) + { + int colonPos = path.indexOf(pos, ':'); + if (colonPos == -1) + { + files.add(new File(path.substring(pos))); + break; + } + + files.add(new File(path.substring(pos, colonPos))); + pos = colonPos + 1; + } + + return (File[]) files.toArray(EMPTY_FILE_ARRAY); + } +} |
From: <lk...@us...> - 2004-06-13 09:59:54
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/cli In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23542 Added Files: package.html Log Message: added package docs for cli --- NEW FILE --- <html> <body> Command line frontend for Clirr. </body> </html> |
From: Simon K. <s_k...@us...> - 2004-06-13 09:46:17
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10425 Modified Files: CoIterator.java Log Message: Inserted necessary typecast (it appears I committed a slightly out-of-date version of this class .. oops). Index: CoIterator.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework/CoIterator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CoIterator.java 13 Jun 2004 09:26:04 -0000 1.1 +++ CoIterator.java 13 Jun 2004 09:46:08 -0000 1.2 @@ -95,8 +95,8 @@ public CoIterator(Comparator comparator, Object[] left, Object[] right) { this.comparator = comparator; - this.left = left.clone(); - this.right = right.clone(); + this.left = (Object[]) left.clone(); + this.right = (Object[]) right.clone(); Arrays.sort(this.left, comparator); Arrays.sort(this.right, comparator); |
From: <lak...@t-...> - 2004-06-13 09:42:09
|
Vincent, to me the maven multiproject approach basically looks OK, although I still don't see how to express dependencies between subprojects (i.e. framework must be compiled before ant and cli). In an earlier mail you said that the individual projects would install their artifacts in the maven repository. But how does multiproject know that framework is outdated and should be rebuilt before trying to compile cli? The name "framework" does not really fit, the current framework java package is not meant to be something that is externally visible. It's an internal package that should be used by checks only. Maybe "core" or "kernel" is a better module name? It should characterize "the stuff that every integration frontend uses" ... I like the "internal" package name approach that Eclipse takes. Everything inside an "internal" package and it's subpackage is not part of the official API. For example it's easy to exclude the internal packages from the module's javadoc (with Ant, don't know about Maven) If we did the same in clirr, that would result in: clirr-core.jar + n.s.c.core (includes Checker and content of current event package) + n.s.c.core.internal.framework (not to be used by integration frontends) + n.s.c.core.internal.checks (dito) clirr-ant.jar + n.s.c.ant clirr-cli.jar + n.s.c.cli The frontend modules should additionally create some "all" modules that increases usability. For example clirr-cli-all.jar would include clirr-cli, clirr-core, bcel, commons-cli and commons-lang, so the user just has to type "java -jar clirr-cli-all.jar -oldversion x.jar -newversion y.jar". WDYT? I think we should do the java package structure changes before we move to multiproject, so we have a clean start there. Lars Lars Kühne wrote: > (resending as I may have sent it with a moderated email address) > > Sending on behalf of Vincent: > > Hi Lars, > > Please find attached the proposed new directory structure + build (it > requires some tuning but it should give an idea of how it works). > > To build the whole project, run "maven dist" in clirr/ > To build only the framework project, cd to clirr/framework/ and type > "maven jar" or "maven dist". > > To build the whole website, run "maven multiproject:site" in clirr/. > If we want to customize the home page we'll need to add a top level > xdoc/ directory. > > Notice also that I've named the clirr framework artifact: > clirr-framework (instead of just clirr). > > Let me know if I can commit this. > > Also, I think we would need to update or java package structure for > the framework project: > > net.sf.clirr.framework > net.sf.clirr.integration.ant > net.sf.clirr.integration.maven > net.sf.clirr.integration.eclipse > [...] > > If we keep net.sf.clirr for the framework it will be more difficult to > change in the future so we may want to get it right now (that's what I > had to do for Cactus...). > > What do you think? > > -Vincent > |
From: Simon K. <s_k...@us...> - 2004-06-13 09:33:32
|
Update of /cvsroot/clirr/clirr/src/test/net/sf/clirr/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30947 Added Files: CoIteratorTest.java Log Message: Initial version --- NEW FILE --- package net.sf.clirr.framework; import java.util.ArrayList; import junit.framework.TestCase; /** * Tests for the CoIterator class. */ public class CoIteratorTest extends TestCase { public void testBasics() { ArrayList coll1 = new ArrayList(); ArrayList coll2 = new ArrayList(); coll1.add("delta"); coll1.add("beta"); coll1.add("echo"); coll1.add("foxtrot"); coll2.add("delta"); coll2.add("beta"); coll2.add("foxtrot"); coll2.add("alpha"); coll2.add("golf"); coll2.add("hotel"); CoIterator iter = new CoIterator(null, coll1, coll2); ArrayList lefts = new ArrayList(); ArrayList rights = new ArrayList(); while (iter.hasNext()) { iter.next(); lefts.add(iter.getLeft()); rights.add(iter.getRight()); } int coll1Size = coll1.size(); int coll2Size = coll2.size(); assertEquals(7, lefts.size()); assertEquals(7, rights.size()); assertEquals("lefts should not have alpha", null, lefts.get(0)); assertEquals("rights should have alpha", "alpha", rights.get(0)); assertEquals("lefts should have beta", "beta", lefts.get(1)); assertEquals("rights should have beta", "beta", rights.get(1)); assertEquals("delta", lefts.get(2)); assertEquals("delta", rights.get(2)); assertEquals("echo", lefts.get(3)); assertEquals(null, rights.get(3)); assertEquals("foxtrot", lefts.get(4)); assertEquals("foxtrot", rights.get(4)); assertEquals(null, lefts.get(5)); assertEquals("golf", rights.get(5)); assertEquals(null, lefts.get(6)); assertEquals("hotel", rights.get(6)); } } |
From: Simon K. <s_k...@us...> - 2004-06-13 09:32:07
|
Update of /cvsroot/clirr/clirr/src/test/net/sf/clirr/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29634/framework Log Message: Directory /cvsroot/clirr/clirr/src/test/net/sf/clirr/framework added to the repository |
From: Simon K. <s_k...@us...> - 2004-06-13 09:27:28
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25503 Added Files: JavaClassNameComparator.java Log Message: Initial version --- NEW FILE --- ////////////////////////////////////////////////////////////////////////////// // Clirr: compares two versions of a java library for binary compatibility // Copyright (C) 2003 - 2004 Lars Kühne // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ////////////////////////////////////////////////////////////////////////////// package net.sf.clirr.framework; import java.util.Comparator; import org.apache.bcel.classfile.JavaClass; /** * A class which specifies that JavaClass instances are ordered * by string comparisons of their names. */ public class JavaClassNameComparator implements Comparator { public static final JavaClassNameComparator COMPARATOR = new JavaClassNameComparator(); public int compare(Object o1, Object o2) { String n1 = ((JavaClass)o1).getClassName(); String n2 = ((JavaClass)o2).getClassName(); return n1.compareTo(n2); } } |
From: Simon K. <s_k...@us...> - 2004-06-13 09:26:17
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24382 Added Files: CoIterator.java Log Message: Initial version --- NEW FILE --- ////////////////////////////////////////////////////////////////////////////// // Clirr: compares two versions of a java library for binary compatibility // Copyright (C) 2003 - 2004 Lars Kühne // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ////////////////////////////////////////////////////////////////////////////// package net.sf.clirr.framework; import java.util.Collection; import java.util.Comparator; import java.util.Arrays; import java.util.NoSuchElementException; /** * This is an iterator that walks a pair of collections, returning * matching pairs from the set. * <p> * When an element is present in the left set but there is no equal object * in the right set, the pair (leftobj, null) is returned. * <p> * When an element is present in the right set but there is no equal object * in the left set, the pair (null, rightobj) is returned. * <p> * When an element in one set has an equal element in the other set, the * pair (leftobj, rightobj) is returned. * <p> * Note that the phrase "pair is returned" above actually means that the * getLeft and getRight methods on the iterator return those objects; the * pair is "conceptual" rather than a physical Pair instance. This avoids * instantiating an object to represent the pair for each step of the * iterator which would not be efficient. * <p> * Note also that elements from the sets are always returned in the order * defined by the provided comparator. * * @author Simon Kitching. */ public class CoIterator { private Object[] left; private Object[] right; private int leftIndex; private int rightIndex; private Object currLeft; private Object currRight; private Comparator comparator; /** * Iterate over the two collections, using the provided comparator. * <p> * The collections are not modified by this iterator. * * @param comparator is used to compare elements from the two collections. * If null, then the objects in the collections are expected to implement * the Comparable interface. */ public CoIterator(Comparator comparator, Collection left, Collection right) { this.comparator = comparator; this.left = left.toArray(); this.right = right.toArray(); Arrays.sort(this.left, comparator); Arrays.sort(this.right, comparator); } /** * Iterate over the objects in the two arrays, using the provided comparator. * <p> * The arrays are not modified by this iterator. In particular, the * iterator returns the elements in ascending order, but the actual * arrays passed in here are cloned so that they are not modified. * * @param comparator is used to compare elements from the two collections. * If null, then the objects in the collections are expected to implement * the Comparable interface. */ public CoIterator(Comparator comparator, Object[] left, Object[] right) { this.comparator = comparator; this.left = left.clone(); this.right = right.clone(); Arrays.sort(this.left, comparator); Arrays.sort(this.right, comparator); } /** * Indicates whether there are any more elements to be returned. */ public boolean hasNext() { return (leftIndex < left.length) || (rightIndex < right.length); } /** * Moves this iterator object to refer to the next "pair" of objects. * <p> * Note that unlike the standard java.util.Iterator, this method does * not return anything; it simply modifies which objects will be * returned by the getLeft and getRight methods. * * @throws NoSuchElementException if this is called when hasNext would * report false (this is standard iterator behaviour). */ public void next() { boolean haveLeft = leftIndex < left.length; boolean haveRight = rightIndex < right.length; if (!haveLeft && !haveRight) { currLeft = null; currRight = null; throw new NoSuchElementException(); } int order; if (haveLeft && !haveRight) { order = -1; } else if (!haveLeft && haveRight) { order = +1; } else if (comparator != null) { order = comparator.compare(left[leftIndex], right[rightIndex]); } else { Comparable c1 = (Comparable) left[leftIndex]; order = c1.compareTo(right[rightIndex]); } if (order < 0) { currLeft = left[leftIndex]; currRight = null; ++leftIndex; } else if (order > 0) { currLeft = null; currRight = right[rightIndex]; ++rightIndex; } else { currLeft = left[leftIndex]; currRight = right[rightIndex]; ++leftIndex; ++rightIndex; } } /** * Return an object from the "left" collection specified to this object's * constructor. When the iterator has selected an element in the "right" * collection for which there is no corresponding element in the left * collection, then this will return null. */ public Object getLeft() { return currLeft; } /** * See getLeft. */ public Object getRight() { return currRight; } } |
From: <lak...@t-...> - 2004-06-13 06:10:32
|
When I started Clirr, I wanted to build the check modules as visitors, as the visitor pattern has worked out great over at Checkstyle - the individual modules/checks would be totally independent (very much unlike the current code in MethodSetCheck). My only problem was: How do you apply the Visitor pattern to walk two trees in parallel. Your CoIterator approach is a great first step into that direction, so +1 from me. Lars Simon Kitching wrote: >Kiora! > >Attached is a class I would like to add to the framework dir for >iterating over two collections of objects, returning "pairs" of equal >items (and pairs with one element set to null for items in either set >without an equivalent item in the other set). > >This can be used for iterating over two sets of JavaClass objects, or >two sets of Field objects, or two sets of Method objects, etc. > >I would like to then update existing code which implements this >functionality in many of the checks to use the CoIterator instead. To >show how this works, attached is an updated AddedClassCheck class. > >All feedback welcome. > >Regards, > >Simon > > > |
From: Simon K. <si...@ec...> - 2004-06-11 05:11:45
|
On Fri, 2004-06-11 at 16:51, Lars K=FChne wrote: > Simon Kitching wrote: >=20 > >Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework > >In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2826/net/sf/clir= r/framework > >--- NEW FILE --- > >[...] =20 > > public CheckerException(String msg, Throwable t) > > { > > super(msg, t); > > =20 > > >=20 > That super-constructor was not available in JDK 1.3. >=20 > Introducing a dependency on 1.4 is OK with me, just wanted to make sure= =20 > that it doesn't go unnoticed. Yes, sorry about that. I was aware of it, and wasn't sure whether to commit this version, or one with the standard workaround for this issue. I decided to commit the simplest version first, but forgot to point this out. I suspect that in order to get widespread use of clirr, it will be necessary to run under java1.3. Sad but probably unavoidable. In particular, people who want to make sure their apps/libs are *useable* on java 1.3 really need to compile on 1.3 then run their unit tests. So they will probably want *all* their build tools to run under 1.3, including clirr. Cheers, Simon |
From: <lak...@t-...> - 2004-06-11 04:48:55
|
Simon Kitching wrote: >Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework >In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2826/net/sf/clirr/framework > >Added Files: > CheckerException.java >Log Message: >Add a new exception type to be used for reporting failures of the >checking process. Modify Checker.java to throw this exception rather >than an ant.BuildException instance on failure. > > >--- NEW FILE --- >[...] > public CheckerException(String msg, Throwable t) > { > super(msg, t); > > That super-constructor was not available in JDK 1.3. Introducing a dependency on 1.4 is OK with me, just wanted to make sure that it doesn't go unnoticed. Lars |
From: Simon K. <s_k...@us...> - 2004-06-11 03:52:34
|
Update of /cvsroot/clirr/clirr/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20244 Modified Files: changes.xml Log Message: command-line-interface added Index: changes.xml =================================================================== RCS file: /cvsroot/clirr/clirr/xdocs/changes.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- changes.xml 8 Jun 2004 22:58:02 -0000 1.10 +++ changes.xml 11 Jun 2004 03:52:24 -0000 1.11 @@ -22,6 +22,11 @@ <action dev="s_kitching" type="add"> Report on methods being deprecated or undeprecated. </action> + <action dev="s_kitching" type="add"> + Added a command-line interface, net.sf.clirr.cli.Clirr, + for running checks and generating reports from the + command-line. + </action> </release> <release version="0.3" date="2004-05-23"> |
From: Simon K. <s_k...@us...> - 2004-06-11 00:38:49
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15016 Modified Files: ClassSelector.java Log Message: Filter out anonymous classes - we never want these. Index: ClassSelector.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/framework/ClassSelector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ClassSelector.java 5 Jun 2004 16:15:34 -0000 1.1 +++ ClassSelector.java 11 Jun 2004 00:38:29 -0000 1.2 @@ -99,6 +99,11 @@ */ public boolean isSelected(JavaClass clazz) { + if (isAnonymousInnerClass(clazz)) + { + return false; + } + boolean matches = matchesCriteria(clazz); if (mode == MODE_IF) { @@ -111,6 +116,33 @@ } /** + * Return true if this class is an anonymous inner class. + * Not even developers working on a package would be interested + * in API changes in these classes... + */ + private boolean isAnonymousInnerClass(JavaClass clazz) + { + String name = clazz.getClassName(); + int dollarPos = name.indexOf('$'); + if (dollarPos == -1) + { + return false; + } + + for(int i=dollarPos+1; i<name.length(); ++i) + { + if (!Character.isDigit(name.charAt(i))) + { + return false; + } + } + + // ok, we have a class name which contains a dollar sign, and + // every subsequent character is a digit. + return true; + } + + /** * Return true if this class matches one of the criteria stored * in this object. */ |
From: Simon K. <s_k...@us...> - 2004-06-11 00:37:47
|
Update of /cvsroot/clirr/clirr/src/java/net/sf/clirr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13660 Modified Files: Checker.java Log Message: Actually use the classSelector parameter! Index: Checker.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/java/net/sf/clirr/Checker.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Checker.java 11 Jun 2004 00:02:21 -0000 1.12 +++ Checker.java 11 Jun 2004 00:37:37 -0000 1.13 @@ -239,7 +239,7 @@ if (!zipEntry.isDirectory() && zipEntry.getName().endsWith(".class")) { JavaClass clazz = extractClass(zipEntry, zip, repository); - if (scopeSelector.isSelected(clazz)) + if (scopeSelector.isSelected(clazz) && classSelector.isSelected(clazz)) { ret.add(clazz); } |
From: Simon K. <si...@ec...> - 2004-06-11 00:33:25
|
Kiora! Attached is a class I would like to add to the framework dir for iterating over two collections of objects, returning "pairs" of equal items (and pairs with one element set to null for items in either set without an equivalent item in the other set). This can be used for iterating over two sets of JavaClass objects, or two sets of Field objects, or two sets of Method objects, etc. I would like to then update existing code which implements this functionality in many of the checks to use the CoIterator instead. To show how this works, attached is an updated AddedClassCheck class. All feedback welcome. Regards, Simon |
From: Simon K. <s_k...@us...> - 2004-06-11 00:26:45
|
Update of /cvsroot/clirr/clirr/src/test/net/sf/clirr/checks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32570/net/sf/clirr/checks Modified Files: AbstractCheckTestCase.java Log Message: Handle fact that Checker.reportDiffs now throws CheckerException Index: AbstractCheckTestCase.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/test/net/sf/clirr/checks/AbstractCheckTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AbstractCheckTestCase.java 5 Jun 2004 16:29:24 -0000 1.2 +++ AbstractCheckTestCase.java 11 Jun 2004 00:26:36 -0000 1.3 @@ -50,12 +50,19 @@ TestDiffListener tdl = new TestDiffListener(); Checker checker = CheckerFactory.createChecker(createCheck(tdl)); ClassSelector classSelector = createClassSelector(); - - checker.reportDiffs( - getBaseLine(), getCurrent(), - new URLClassLoader(new URL[]{}), - new URLClassLoader(new URL[]{}), - classSelector); + + try + { + checker.reportDiffs( + getBaseLine(), getCurrent(), + new URLClassLoader(new URL[]{}), + new URLClassLoader(new URL[]{}), + classSelector); + } + catch(Exception ex) + { + fail("Exception generated:" + ex.getMessage()); + } tdl.checkExpected(expected); } |