mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 09:59:25 +00:00
don't require default interface methods to be implemented
This commit is contained in:
@@ -21,15 +21,16 @@ function checkImplementedInterfaces(source_type, probs) {
|
|||||||
if (source_type.modifiers.includes('abstract')) {
|
if (source_type.modifiers.includes('abstract')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/** @type {Set<CEIType>} */
|
||||||
const interfaces = new Set(), supers_done = new Set();
|
const interfaces = new Set(), supers_done = new Set();
|
||||||
const supers = source_type.supers.slice();
|
const supers = source_type.supers.slice();
|
||||||
while (supers.length) {
|
while (supers.length) {
|
||||||
const s = supers.shift();
|
const s = supers.shift();
|
||||||
supers_done.add(s);
|
supers_done.add(s);
|
||||||
if (s.typeKind === 'interface') {
|
|
||||||
interfaces.add(s);
|
|
||||||
}
|
|
||||||
if (s instanceof CEIType) {
|
if (s instanceof CEIType) {
|
||||||
|
if (s.typeKind === 'interface') {
|
||||||
|
interfaces.add(s);
|
||||||
|
}
|
||||||
s.supers.filter(s => !supers_done.has(s)).forEach(s => supers.push(s));
|
s.supers.filter(s => !supers_done.has(s)).forEach(s => supers.push(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,6 +39,10 @@ function checkImplementedInterfaces(source_type, probs) {
|
|||||||
interfaces.forEach((intf, i) => {
|
interfaces.forEach((intf, i) => {
|
||||||
const missing_methods = [];
|
const missing_methods = [];
|
||||||
intf.methods.forEach(m => {
|
intf.methods.forEach(m => {
|
||||||
|
// default methods don't require implementing
|
||||||
|
if (m.hasImplementation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const namedsig = `${m.name}${m.methodSignature}`
|
const namedsig = `${m.name}${m.methodSignature}`
|
||||||
if (implemented.indexOf(namedsig) < 0) {
|
if (implemented.indexOf(namedsig) < 0) {
|
||||||
missing_methods.push(nonAbstractLabel(m.label));
|
missing_methods.push(nonAbstractLabel(m.label));
|
||||||
|
|||||||
Reference in New Issue
Block a user