Metrics and Eclipse 3.3

Help
pepe
2008-01-24
2013-04-24
  • pepe
    pepe
    2008-01-24

    Is it possible to use Metrics 1.3.6 on Eclipse Europa version, or is there any other more up to date plugin anywhere else ?

    Thanks for your answer.

    Best regards,

     
    • G.B.
      G.B.
      2008-04-15

      For me it worked fine with eclipse europa and metrics 1.3.6 ... but I have code compliant with JDK 1.4 ...
      For code using gramar of JDk 1.5 and 1.6 I've updated the plugin with some sources from the Release_1_3_6 branch
      I'll try to upload them or to post the changes I made here just in case some one is interested .

       
    • G.B.
      G.B.
      2008-04-16

      It seams that I don't have any more access to CVS ... :(
      here are the patch

      Index: src/net/sourceforge/metrics/core/sources/CompilationUnitMetrics.java
          ===================================================================
          RCS file: /cvsroot/metrics/net.sourceforge.metrics/src/net/sourceforge/metrics/core/sources/CompilationUnitMetrics.java,v
          retrieving revision 1.41
          diff -u -r1.41 CompilationUnitMetrics.java
          --- src/net/sourceforge/metrics/core/sources/CompilationUnitMetrics.java    29 May 2004 03:39:38 -0000    1.41
          +++ src/net/sourceforge/metrics/core/sources/CompilationUnitMetrics.java    16 Apr 2008 19:37:17 -0000
          @@ -120,7 +120,7 @@
              
               private CompilationUnit getAST() {
                   try {
          -            ASTParser parser = ASTParser.newParser(AST.JLS2);
          +            ASTParser parser = ASTParser.newParser(AST.JLS3);
                       parser.setSource((ICompilationUnit)getJavaElement());
                       return (CompilationUnit) parser.createAST(null);
                       //return AST.parseCompilationUnit((ICompilationUnit)getJavaElement(), false);
          Index: src/net/sourceforge/metrics/calculators/McCabe.java
          ===================================================================
          RCS file: /cvsroot/metrics/net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/McCabe.java,v
          retrieving revision 1.14
          diff -u -r1.14 McCabe.java
          --- src/net/sourceforge/metrics/calculators/McCabe.java    17 May 2005 18:21:04 -0000    1.14
          +++ src/net/sourceforge/metrics/calculators/McCabe.java    16 Apr 2008 19:37:16 -0000
          @@ -31,6 +31,7 @@
           import org.eclipse.jdt.core.dom.CatchClause;
           import org.eclipse.jdt.core.dom.ConditionalExpression;
           import org.eclipse.jdt.core.dom.DoStatement;
          +import org.eclipse.jdt.core.dom.EnhancedForStatement;
           import org.eclipse.jdt.core.dom.Expression;
           import org.eclipse.jdt.core.dom.ExpressionStatement;
           import org.eclipse.jdt.core.dom.ForStatement;
          @@ -97,6 +98,11 @@
                       inspectExpression(node.getExpression());
                       return true;
                   }
          +        public boolean visit(EnhancedForStatement node) {
          +            cyclomatic++;
          +            inspectExpression(node.getExpression());
          +            return true;
          +        }
                   public boolean visit(ForStatement node) {
                       cyclomatic++;
                       inspectExpression(node.getExpression());

       
    • G.B.
      G.B.
      2008-04-22

      still missing support of enum.
      Any one as an idea of what to do with enums ?