Skip to content

Commit

Permalink
Fix the hierarchy traversal order
Browse files Browse the repository at this point in the history
Ensure that interfaces follow superclasses and superclasses do not
preced subclasses.

Fixes #38.
  • Loading branch information
ogolberg authored Dec 8, 2023
1 parent 1f4d4e8 commit 33f6e0a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class InspectedTypes private constructor(
val superTypes = mutableSetOf<OptionalType>()
val superTypeNames = mutableListOf<String>()

superTypeNames.addAll(cls.interfaces)
cls.superName?.let { superTypeNames.add(it) }
superTypeNames.addAll(cls.interfaces)

for (s in superTypeNames) {
val l = lookup(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ void arrayCloneIsOk() {
array.clone();
}

void subclassCloneIsOk() throws Exception {
Clones.C xx = new Clones.C();

xx.clone();
}

void arrayLengthIsOk() {
int[] array = new int[0];
int i = array.length;
Expand Down
22 changes: 22 additions & 0 deletions tests/src/main/java/com/toasttab/expediter/test/caller/Clones.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.toasttab.expediter.test.caller;

public class Clones {
static class A implements Cloneable {
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}

static class B extends A {

}

static class C extends B implements D {

}

static interface D {

}
}

0 comments on commit 33f6e0a

Please sign in to comment.