This simple example demonstrates the problem:
public class Main {
interface Person {
default int amountOfHands() {
return 2;
}
}
public static class BasicPerson implements Person {
int numberOfFaces() {
return 1;
}
}
public static void main(String[] args) {
System.out.println("Put a breakpoint here");
}
}
I ran this code in IntelliJ IDEA in debug mode and put two watches in the main method:
new BasicPerson().amountOfHands();
new BasicPerson().numberOfFaces();
Both methods should return a primitive int, however only the second watch (class method) shows a primitive int, when the first one (default interface method) shows a boxed Integer object.
Why is that? Is that a bug?