From 9ed5cfb8a564282f5e92241e15fb8003f03b967e Mon Sep 17 00:00:00 2001 From: tsantalis Date: Thu, 24 Oct 2024 14:35:13 -0400 Subject: [PATCH] Fix the computation of potentially extracted methods --- .../java/org/codetracker/FileTrackerImpl.java | 12 +++++++-- .../FileTrackerWithLocalFilesImpl.java | 12 +++++++-- .../blame/blameTestUntilCommitZero.txt | 22 ++++++++-------- .../blame/blameTestWithLocalRepo21.txt | 26 +++++++++---------- 4 files changed, 44 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/codetracker/FileTrackerImpl.java b/src/main/java/org/codetracker/FileTrackerImpl.java index e4263b7c87c..8e67607a23a 100644 --- a/src/main/java/org/codetracker/FileTrackerImpl.java +++ b/src/main/java/org/codetracker/FileTrackerImpl.java @@ -45,6 +45,7 @@ import gr.uom.java.xmi.UMLAbstractClass; import gr.uom.java.xmi.UMLAnonymousClass; import gr.uom.java.xmi.UMLAttribute; +import gr.uom.java.xmi.UMLClass; import gr.uom.java.xmi.decomposition.OperationBody; import gr.uom.java.xmi.decomposition.UMLOperationBodyMapper; import gr.uom.java.xmi.diff.ExtractClassRefactoring; @@ -1787,8 +1788,15 @@ private void processNestedStatementsAndComments(UMLModel rightModel, Version cur List rightSideOperations = new ArrayList(); for(UMLAbstractClass umlClass : rightModel.getClassList()) { if(umlClass.getName().equals(rightMethod.getUmlOperation().getClassName())) { - rightSideOperations.addAll(umlClass.getOperations()); - rightSideOperations.remove(rightMethod.getUmlOperation()); + UMLClass leftClass = leftModel.getClass((UMLClass)umlClass); + if(leftClass != null) { + for(UMLOperation operation : umlClass.getOperations()) { + if(!leftClass.containsOperationWithTheSameSignature(operation)) { + rightSideOperations.add(operation); + } + } + rightSideOperations.remove(rightMethod.getUmlOperation()); + } } } boolean allMapped = diff --git a/src/main/java/org/codetracker/FileTrackerWithLocalFilesImpl.java b/src/main/java/org/codetracker/FileTrackerWithLocalFilesImpl.java index 1b6c83512de..5ab7e964e5c 100644 --- a/src/main/java/org/codetracker/FileTrackerWithLocalFilesImpl.java +++ b/src/main/java/org/codetracker/FileTrackerWithLocalFilesImpl.java @@ -38,6 +38,7 @@ import org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl; import gr.uom.java.xmi.UMLAttribute; +import gr.uom.java.xmi.UMLClass; import gr.uom.java.xmi.UMLEnumConstant; import gr.uom.java.xmi.UMLInitializer; import gr.uom.java.xmi.UMLJavadoc; @@ -1794,8 +1795,15 @@ private void processNestedStatementsAndComments(UMLModel rightModel, Version cur List rightSideOperations = new ArrayList(); for(UMLAbstractClass umlClass : rightModel.getClassList()) { if(umlClass.getName().equals(rightMethod.getUmlOperation().getClassName())) { - rightSideOperations.addAll(umlClass.getOperations()); - rightSideOperations.remove(rightMethod.getUmlOperation()); + UMLClass leftClass = leftModel.getClass((UMLClass)umlClass); + if(leftClass != null) { + for(UMLOperation operation : umlClass.getOperations()) { + if(!leftClass.containsOperationWithTheSameSignature(operation)) { + rightSideOperations.add(operation); + } + } + rightSideOperations.remove(rightMethod.getUmlOperation()); + } } } boolean allMapped = diff --git a/src/test/resources/blame/blameTestUntilCommitZero.txt b/src/test/resources/blame/blameTestUntilCommitZero.txt index 55550f20ca9..6b1197eca09 100644 --- a/src/test/resources/blame/blameTestUntilCommitZero.txt +++ b/src/test/resources/blame/blameTestUntilCommitZero.txt @@ -415,7 +415,7 @@ ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java 6a415915c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-15 21:49:47 +0000 415) * the shallow commits in the client 6a415915c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-15 21:49:47 +0000 416) */ 6a415915c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-15 21:49:47 +0000 417) public void setClientShallowCommits(Set clientShallowCommits) { -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 21:47:23 +0000 418) stats.clientShallowCommits = Collections +6a415915c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-15 21:49:47 +0000 418) stats.clientShallowCommits = Collections 3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 21:47:23 +0000 419) .unmodifiableSet(new HashSet<>(clientShallowCommits)); 6a415915c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-15 21:49:47 +0000 420) } 421) @@ -911,7 +911,7 @@ c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter 9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 21:04:23 +0000 911) if (shallowPack && !(walk instanceof DepthWalk.ObjectWalk)) d385a7a5e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 22:37:36 +0000 912) throw new IllegalArgumentException( d385a7a5e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 22:37:36 +0000 913) JGitText.get().shallowPacksRequireDepthWalk); -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 22:25:21 +0000 914) findObjectsToPack(countingMonitor, walk, interestingObjects, +5664fb3bf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 21:43:11 +0000 914) findObjectsToPack(countingMonitor, walk, interestingObjects, c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 22:25:21 +0000 915) uninterestingObjects, noBitmaps); 74333e63b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-16 19:18:39 +0000 916) } 917) @@ -1302,10 +1302,10 @@ dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-10 02:14:18 +0000 1302) // really benefit from delta compression. Consequently just don't dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-10 02:14:18 +0000 1303) // bother examining those types here. dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-10 02:14:18 +0000 1304) // -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 16:43:02 +0000 1305) ObjectToPack[] list = new ObjectToPack[ +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-10 02:14:18 +0000 1305) ObjectToPack[] list = new ObjectToPack[ 8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 16:43:02 +0000 1306) objectsLists[OBJ_TREE].size() 8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 16:43:02 +0000 1307) + objectsLists[OBJ_BLOB].size() -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 16:43:02 +0000 1308) + edgeObjects.size()]; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-10 02:14:18 +0000 1308) + edgeObjects.size()]; dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-10 02:14:18 +0000 1309) int cnt = 0; 8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 16:43:02 +0000 1310) cnt = findObjectsNeedingDelta(list, cnt, OBJ_TREE); 8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 16:43:02 +0000 1311) cnt = findObjectsNeedingDelta(list, cnt, OBJ_BLOB); @@ -1791,7 +1791,7 @@ dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 1791) BitmapIndex bitmapIndex = reader.getBitmapIndex(); dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 1792) if (bitmapIndex != null) { ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 23:41:31 +0000 1793) BitmapWalker bitmapWalker = new BitmapWalker( -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 23:41:31 +0000 1794) walker, bitmapIndex, countingMonitor); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 1794) walker, bitmapIndex, countingMonitor); dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 1795) findObjectsToPackUsingBitmaps(bitmapWalker, want, have); dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 1796) endPhase(countingMonitor); dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 1797) stats.timeCounting = System.currentTimeMillis() - countingStart; @@ -1957,7 +1957,7 @@ a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java 733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 05:32:03 +0000 1957) commits = null; 1958) 99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 22:10:11 +0000 1959) if (thin && !baseTrees.isEmpty()) { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 21:20:22 +0000 1960) BaseSearch bases = new BaseSearch(countingMonitor, baseTrees, // +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 15:12:06 +0000 1960) BaseSearch bases = new BaseSearch(countingMonitor, baseTrees, // 461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 21:20:22 +0000 1961) objectsMap, edgeObjects, reader); 1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 23:47:03 +0000 1962) RevObject o; 1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 23:47:03 +0000 1963) while ((o = walker.nextObject()) != null) { @@ -2080,10 +2080,10 @@ be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java 2080) 4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 20:46:42 +0000 2081) // Check if this object needs to be rejected, doing the cheaper 4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 20:46:42 +0000 2082) // checks first. -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-21 00:09:05 +0000 2083) boolean reject = filterBlobLimit >= 0 && -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-21 00:09:05 +0000 2084) type == OBJ_BLOB && +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 20:46:42 +0000 2083) boolean reject = filterBlobLimit >= 0 && +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 20:46:42 +0000 2084) type == OBJ_BLOB && 32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-21 00:09:05 +0000 2085) !want.contains(src) && -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-21 00:09:05 +0000 2086) reader.getObjectSize(src, OBJ_BLOB) > filterBlobLimit; +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 20:46:42 +0000 2086) reader.getObjectSize(src, OBJ_BLOB) > filterBlobLimit; 4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 20:46:42 +0000 2087) if (!reject) { 4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 20:46:42 +0000 2088) addObject(src, type, pathHashCode); 4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 20:46:42 +0000 2089) } @@ -2208,7 +2208,7 @@ dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java 4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 17:13:44 +0000 2208) writeBitmaps = new PackBitmapIndexBuilder(byName); 4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 17:13:44 +0000 2209) byName = null; 2210) -80c7884ea org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-10-22 05:12:52 +0000 2211) PackWriterBitmapPreparer bitmapPreparer = new PackWriterBitmapPreparer( +f82821728 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:15:19 +0000 2211) PackWriterBitmapPreparer bitmapPreparer = new PackWriterBitmapPreparer( 80c7884ea org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-10-22 05:12:52 +0000 2212) reader, writeBitmaps, pm, stats.interestingObjects, config); 2213) c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 22:25:21 +0000 2214) Collection selectedCommits = bitmapPreparer @@ -2222,7 +2222,7 @@ dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java 8f7d0a4fb org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Zhen Chen 2017-05-03 22:02:33 +0000 2222) if (!cmit.isReuseWalker()) { dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 2223) walker = bitmapPreparer.newBitmapWalker(); dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 2224) } -9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 13:45:46 +0000 2225) BitmapBuilder bitmap = walker.findObjects( +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 2225) BitmapBuilder bitmap = walker.findObjects( 9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 13:45:46 +0000 2226) Collections.singleton(cmit), null, false); 2227) dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 19:14:45 +0000 2228) if (last != null && cmit.isReuseWalker() && !bitmap.contains(last)) diff --git a/src/test/resources/blame/blameTestWithLocalRepo21.txt b/src/test/resources/blame/blameTestWithLocalRepo21.txt index 728e069a61c..c2d295f249a 100644 --- a/src/test/resources/blame/blameTestWithLocalRepo21.txt +++ b/src/test/resources/blame/blameTestWithLocalRepo21.txt @@ -349,18 +349,18 @@ de9c2b0e3 pmd/src/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver 35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 349) if (dotSplitImage.length == 1 && astArguments != null) { // method 1426b23ce pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 350) List methods = getLocalApplicableMethods(node, dotSplitImage[0], 1426b23ce pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 351) Collections.emptyList(), -1426b23ce pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 352) methodArgsArity, accessingClass); +35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 352) methodArgsArity, accessingClass); 353) bc20be1ed pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 354) TypeNode enclosingType = getEnclosingTypeDeclaration(node); bc20be1ed pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 355) if (enclosingType == null) { bc20be1ed pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 356) return data; // we can't proceed, probably uncompiled sources bc20be1ed pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 357) } 358) -90b802526 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 359) previousType = getBestMethodReturnType(enclosingType.getTypeDefinition(), -90b802526 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 360) methods, astArgumentList); +bc20be1ed pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 359) previousType = getBestMethodReturnType(enclosingType.getTypeDefinition(), +bc20be1ed pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 360) methods, astArgumentList); 35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 361) } else { // field -35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 362) previousType = getTypeDefinitionOfVariableFromScope(node.getScope(), dotSplitImage[0], -35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 363) accessingClass); +2146a077e pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-24 17:38:08 +0000 362) previousType = getTypeDefinitionOfVariableFromScope(node.getScope(), dotSplitImage[0], +2146a077e pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-24 17:38:08 +0000 363) accessingClass); 35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 364) } 800cfa6e4 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-19 19:22:09 +0000 365) startIndex = 1; // first element's type in dotSplitImage has already been resolved 800cfa6e4 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-19 19:22:09 +0000 366) } @@ -384,7 +384,7 @@ c8763bef1 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/Cl c8763bef1 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-03 22:28:38 +0000 384) } 385) 35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 386) if (i == dotSplitImage.length - 1 && astArguments != null) { // method -bd503ba13 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-02 19:13:28 +0000 387) List methods = getApplicableMethods(previousType, dotSplitImage[i], +995933889 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-27 14:50:50 +0000 387) List methods = getApplicableMethods(previousType, dotSplitImage[i], bd503ba13 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-02 19:13:28 +0000 388) Collections.emptyList(), bd503ba13 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-02 19:13:28 +0000 389) methodArgsArity, accessingClass); 390) @@ -902,8 +902,8 @@ babe32a16 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/Cl 4175460d3 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-15 13:42:22 +0000 902) // anonymous classes can't have qualified super expression, thus 4175460d3 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-15 13:42:22 +0000 903) // getSuperClassTypeDefinition's second argumet isn't null, but we are not 4175460d3 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-15 13:42:22 +0000 904) // looking for enclosing super types -68c8fabdf pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-14 22:55:55 +0000 905) currentChild.setTypeDefinition( -68c8fabdf pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-14 22:55:55 +0000 906) getSuperClassTypeDefinition(currentChild, previousChild.getType())); +b8e1738f5 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-15 00:48:15 +0000 905) currentChild.setTypeDefinition( +b8e1738f5 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-15 00:48:15 +0000 906) getSuperClassTypeDefinition(currentChild, previousChild.getType())); 0ec1e44b1 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-05-30 18:23:11 +0000 907) } else { // simple 'super' expression 68c8fabdf pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-14 22:55:55 +0000 908) currentChild.setTypeDefinition(getSuperClassTypeDefinition(currentChild, null)); 0ec1e44b1 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-05-30 18:23:11 +0000 909) } @@ -925,14 +925,14 @@ babe32a16 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/Cl 60f6935f8 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-19 19:25:51 +0000 925) int methodArgsArity = getArgumentListArity(astArgumentList); 995933889 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-27 14:50:50 +0000 926) List typeArguments = getMethodExplicitTypeArugments(currentChild); 927) -995933889 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-27 14:50:50 +0000 928) List methods = getApplicableMethods(previousChild.getTypeDefinition(), +35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 928) List methods = getApplicableMethods(previousChild.getTypeDefinition(), 995933889 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-27 14:50:50 +0000 929) currentChildImage, 995933889 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-27 14:50:50 +0000 930) typeArguments, methodArgsArity, accessingClass); 931) 90b802526 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 932) currentChild.setTypeDefinition(getBestMethodReturnType(previousChild.getTypeDefinition(), 90b802526 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-08-15 22:02:34 +0000 933) methods, astArgumentList)); 35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 934) } else { // field -995933889 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-27 14:50:50 +0000 935) currentChild.setTypeDefinition(getFieldType(previousChild.getTypeDefinition(), +b8e1738f5 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-06-15 00:48:15 +0000 935) currentChild.setTypeDefinition(getFieldType(previousChild.getTypeDefinition(), 995933889 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-27 14:50:50 +0000 936) currentChildImage, accessingClass)); 35597c9ef pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-07-03 22:06:32 +0000 937) } babe32a16 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Bendegúz Nagy 2017-05-30 15:37:47 +0000 938) } @@ -1325,8 +1325,8 @@ a11337cab pmd/src/net/sourceforge/pmd/typeresolution/ClassTypeResolver.java 6215d97b9 pmd/src/net/sourceforge/pmd/typeresolution/ClassTypeResolver.java (Allan Caplan 2006-10-26 02:35:38 +0000 1325) } 88477e3f5 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2015-11-20 10:23:25 +0000 1326) if (myType == null && qualifiedName != null && qualifiedName.contains(".")) { 88477e3f5 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2015-11-20 10:23:25 +0000 1327) // try if the last part defines a inner class -88477e3f5 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2015-11-20 10:23:25 +0000 1328) String qualifiedNameInner = qualifiedName.substring(0, qualifiedName.lastIndexOf('.')) + "$" -88477e3f5 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2015-11-20 10:23:25 +0000 1329) + qualifiedName.substring(qualifiedName.lastIndexOf('.') + 1); +0ebcac070 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2016-12-02 09:21:27 +0000 1328) String qualifiedNameInner = qualifiedName.substring(0, qualifiedName.lastIndexOf('.')) + "$" +0ebcac070 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2016-12-02 09:21:27 +0000 1329) + qualifiedName.substring(qualifiedName.lastIndexOf('.') + 1); 88477e3f5 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2015-11-20 10:23:25 +0000 1330) try { 88477e3f5 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2015-11-20 10:23:25 +0000 1331) myType = pmdClassLoader.loadClass(qualifiedNameInner); 3c6a29240 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2018-05-28 19:28:12 +0000 1332) } catch (ClassNotFoundException ignored) { @@ -1425,7 +1425,7 @@ d6213b79b pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/Cl 3c6a29240 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2018-05-28 19:28:12 +0000 1425) // ignored 3c6a29240 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2018-05-28 19:28:12 +0000 1426) } catch (LinkageError e) { d6213b79b pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Clément Fournier 2018-03-24 21:54:37 +0000 1427) if (LOG.isLoggable(Level.FINE)) { -3c6a29240 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2018-05-28 19:28:12 +0000 1428) LOG.log(Level.FINE, "Tried to load class " + fullClassName + " from on demand import, " +d6213b79b pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Clément Fournier 2018-03-24 21:54:37 +0000 1428) LOG.log(Level.FINE, "Tried to load class " + fullClassName + " from on demand import, " 3c6a29240 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Andreas Dangel 2018-05-28 19:28:12 +0000 1429) + "with an incomplete classpath.", e); d6213b79b pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Clément Fournier 2018-03-24 21:54:37 +0000 1430) } d6213b79b pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java (Clément Fournier 2018-03-24 21:54:37 +0000 1431) }