private int matchModule(TypeDeclarationPattern typePattern, TypeBinding type) { if (!(type instanceof ReferenceBinding)) return INACCURATE_MATCH; // a safety net, should not come here for error free code. ReferenceBinding reference = (ReferenceBinding) type; ModuleBinding module = reference.module(); if (module == null || module.moduleName == null || typePattern.moduleNames == null) return POSSIBLE_MATCH; //can't determine, say possible to all. String bindModName = new String(module.moduleName); if (typePattern.modulePatterns == null) {// use 'normal' matching char[][] moduleList = getModuleList(typePattern); for (char[] m : moduleList) { // match any in the list int ret = matchNameValue(m, module.moduleName); if (ret != IMPOSSIBLE_MATCH) return ret; } } else {// use pattern matching for (Pattern p : typePattern.modulePatterns) { Matcher matcher = p.matcher(bindModName); if (matcher.matches()) return ACCURATE_MATCH; } } return IMPOSSIBLE_MATCH; } @Override
private int matchModule(TypeDeclarationPattern typePattern, TypeBinding type) { if (!(type instanceof ReferenceBinding)) return INACCURATE_MATCH; // a safety net, should not come here for error free code. ReferenceBinding reference = (ReferenceBinding) type; ModuleBinding module = reference.module(); if (module == null || module.moduleName == null || typePattern.moduleNames == null) return POSSIBLE_MATCH; //can't determine, say possible to all. String bindModName = new String(module.moduleName); if (typePattern.modulePatterns == null) {// use 'normal' matching char[][] moduleList = getModuleList(typePattern); for (char[] m : moduleList) { // match any in the list int ret = matchNameValue(m, module.moduleName); if (ret != IMPOSSIBLE_MATCH) return ret; } } else {// use pattern matching for (Pattern p : typePattern.modulePatterns) { Matcher matcher = p.matcher(bindModName); if (matcher.matches()) return ACCURATE_MATCH; } } return IMPOSSIBLE_MATCH; } public String toString() {