Fork me on GitHub

CPD Results

The following document contains the results of PMD's CPD 5.3.2.

Duplications

File Line
net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitorAdapter.java 65
net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java 156
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTObjectNameDeclaration node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTFormalParameter node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTMethodDeclaration node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTMethodDeclarator node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTFormalParameters node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTVariableOrConstantDeclarator node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTVariableOrConstantDeclaratorId node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTVariableOrConstantInitializer node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTDatatype node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCompilationDataType node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCollectionTypeName node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTScalarDataTypeName node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTDateTimeLiteral node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTExceptionHandler node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTSkip2NextTerminator node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTSkip2NextOccurrence node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTSkipPastNextOccurrence node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTSkip2NextTokenOccurrence node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTSkipPastNextTokenOccurrence node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTRead2NextOccurrence node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTReadPastNextOccurrence node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTSqlStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTWrappedObject node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTUnlabelledStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTLabelledStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCaseStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCaseWhenClause node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTElseClause node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTElsifClause node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTLoopStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTForStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTWhileStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTIfStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTForIndex node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTForAllIndex node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTForAllStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTGotoStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTReturnStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTContinueStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTExitStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTRaiseStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCloseStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTOpenStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTFetchStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTEmbeddedSqlStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTPipelineStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTConditionalCompilationStatement node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTSubTypeDefinition node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTFieldDeclaration node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCollectionTypeDefinition node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCollectionDeclaration node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTObjectDeclaration node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCallSpecTail node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCursorUnit node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCursorSpecification node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCursorBody node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCompilationExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTAssignment node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCaseExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTLikeExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTTrimExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTObjectExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTConditionalOrExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTConditionalAndExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTEqualityExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTRelationalExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTAdditiveExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTStringExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTMultiplicativeExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTUnaryExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTUnaryExpressionNotPlusMinus node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTPrimaryExpression node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTPrimaryPrefix node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTPrimarySuffix node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTLiteral node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTStringLiteral node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTBooleanLiteral node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTNullLiteral node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTMultiSetCondition node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTNumericLiteral node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTLabel node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTName node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTQualifiedName node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTArguments node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTArgumentList node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTArgument node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTVariableOrConstantDeclaration node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTDatatypeDeclaration node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTPragma node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTInlinePragma node, Object data) {
File Line
net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitorAdapter.java 615
net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java 710
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTCompoundTriggerBlock node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTNonDMLTrigger node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTDDLEvent node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTDatabaseEvent node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTNonDMLEvent node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTAlterTrigger node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTKEYWORD_RESERVED node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTKEYWORD_UNRESERVED node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTID node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTUnqualifiedID node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTQualifiedID node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTTypeKeyword node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTJavaInterfaceClass node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTEqualsOldIDNewID node, Object data) {
		return visit((PLSQLNode) node, data);
	}

        @Override
        public Object visit(ASTAccessibleByClause node, Object data) {
                return visit((PLSQLNode) node, data);
        }
File Line
net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitorAdapter.java 524
net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java 610
	public Object visit(ASTInlinePragma node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTExceptionDeclaration node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTParallelClause node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTTable node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTTableColumn node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTView node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTSynonym node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTDirectory node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTDatabaseLink node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTViewColumn node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTComment node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTTypeMethod node, Object data) {
File Line
net/sourceforge/pmd/lang/plsql/symboltable/ScopeAndDeclarationFinder.java 279
net/sourceforge/pmd/lang/plsql/symboltable/ScopeAndDeclarationFinder.java 323
public Object visit(ASTTypeMethod node, Object data) {
	createMethodScope(node);
	ASTMethodDeclarator md = node.getFirstChildOfType(ASTMethodDeclarator.class);
	// A PLSQL Method (FUNCTION|PROCEDURE) may be schema-level 
	try
	{
	  node.getScope().getEnclosingScope(ClassScope.class).addDeclaration(new MethodNameDeclaration(md));
	}
	catch (Exception e)
	{
	  //@TODO possibly add to a pseudo-ClassScope equivalent to the Schema name
	    if (LOGGER.isLoggable(Level.FINEST)) {
	  LOGGER.finest("ProgramUnit getEnclosingClassScope Exception string=\""+e.getMessage()+"\"");
	    }
	  if("getEnclosingClassScope() called on SourceFileScope".equals(e.getMessage()))
	  {
	      if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("ClassScope skipped for Schema-level method: methodName=" 
		               + node.getMethodName()
		               + "; Image=" + node.getImage()
		              );
	      }
	   
	    //A File-level/Schema-level object may have a Schema-name explicitly specified in the declaration 
	    ASTObjectNameDeclaration on = md.getFirstChildOfType(ASTObjectNameDeclaration.class);
	    if( 1 < on.jjtGetNumChildren())
	    {
              ASTID schemaName = on.getFirstChildOfType(ASTID.class);
              if (LOGGER.isLoggable(Level.FINEST)) {
	      LOGGER.finest("SchemaName for Schema-level method: methodName=" 
				 + node.getMethodName()
				 + "; Image=" + node.getImage()
				 + "is " + schemaName.getImage()
				);
              }
	     
	    }
	  }
	}
	cont(node);
	return data;
  }

    @Override
    public Object visit(ASTProgramUnit node, Object data) {
File Line
net/sourceforge/pmd/lang/plsql/symboltable/LocalScope.java 38
net/sourceforge/pmd/lang/plsql/symboltable/MethodScope.java 48
    }

    @Override
    public void addDeclaration(NameDeclaration declaration) {
        if (declaration instanceof VariableNameDeclaration && getDeclarations().keySet().contains(declaration)) {
            throw new RuntimeException(declaration + " is already in the symbol table");
        }
        super.addDeclaration(declaration);
    }

    public Set<NameDeclaration> findVariableHere(PLSQLNameOccurrence occurrence) {
        Set<NameDeclaration> result = new HashSet<>();
        if (occurrence.isThisOrSuper() || occurrence.isMethodOrConstructorInvocation()) {
            return result;
        }
        ImageFinderFunction finder = new ImageFinderFunction(occurrence.getImage());
        Applier.apply(finder, getVariableDeclarations().keySet().iterator());
        if (finder.getDecl() != null) {
            result.add(finder.getDecl());
        }
        return result;
    }

    public String toString() {
File Line
net/sourceforge/pmd/lang/plsql/rule/codesize/CyclomaticComplexityRule.java 291
net/sourceforge/pmd/lang/plsql/rule/codesize/CyclomaticComplexityRule.java 348
                    || null != node.getFirstParentOfType(ASTTriggerUnit.class) //Trigger of any form
                    //@TODO || null != node.getFirstParentOfType(ASTProgramUnit.class) //Another Procedure
                    //@TODO || null != node.getFirstParentOfType(ASTTypeMethod.class) //Another Type method
               )
            {
              /* @TODO This does not cope with nested methods 
               * We need the outer most 
               * ASTPackageBody
               * ASTTriggerUni
               * ASTProgramUnit
               * ASTTypeMethod
               * 
               */
              Entry classEntry = entryStack.peek();
              classEntry.methodCount++;
              classEntry.bumpDecisionPoints( methodDecisionPoints );

              if ( methodDecisionPoints > classEntry.highestDecisionPoints ) {
                classEntry.highestDecisionPoints = methodDecisionPoints;
              }
            }

	    ASTMethodDeclarator methodDeclarator = null;
	    for ( int n = 0; n < node.jjtGetNumChildren(); n++ ) {
	      Node childNode = node.jjtGetChild( n );
	      if ( childNode instanceof ASTMethodDeclarator ) {
	        methodDeclarator = (ASTMethodDeclarator) childNode;
	        break;
	      }
	    }

	    if ( methodEntry.decisionPoints >= reportLevel ) {
	        addViolation( data, node, new String[] { "method",
	            methodDeclarator == null ? "" : methodDeclarator.getImage(),
	            String.valueOf( methodEntry.decisionPoints ) } );
	      }
    }
    LOGGER.exiting(CLASS_NAME,"visit(ASTProgramUnit)");
File Line
net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitorAdapter.java 11
net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java 99
	}

	@Override
	public Object visit(ASTInput node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTDDLCommand node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTSqlPlusCommand node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTGlobal node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTBlock node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTPackageSpecification node, Object data) {
File Line
net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitorAdapter.java 585
net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java 673
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTAlterTypeSpec node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTAttributeDeclaration node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTAttribute node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTPragmaClause node, Object data) {
		return visit((PLSQLNode) node, data);
	}

	@Override
	public Object visit(ASTTriggerUnit node, Object data) {