Skip to content

Commit

Permalink
Fix package checking for array types
Browse files Browse the repository at this point in the history
Compare the root component classes when checking isSamePackage().

Signed-off-by: Peter Bain <peter_bain@ca.ibm.com>
  • Loading branch information
pdbain-ibm committed Sep 25, 2018
1 parent f4dcaaa commit ce58f60
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,20 @@ private static boolean isSamePackage(Class<?> a, Class<?> b){
return true;
}

while (a.isArray()) {
a = a.getComponentType();
}

while (b.isArray()) {
b = b.getComponentType();
}

VMLangAccess vma = getVMLangAccess();

String packageName1 = vma.getPackageName(a);
String packageName2 = vma.getPackageName(b);
// If the string value is different, they're definitely not related
if((packageName1 == null) || (packageName2 == null) || !packageName1.equals(packageName2)) {
if ((packageName1 == null) || (packageName2 == null) || !packageName1.equals(packageName2)) {
return false;
}

Expand Down

0 comments on commit ce58f60

Please sign in to comment.