This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 241740
Collapse All | Expand All

(-)a/php.editor/src/org/netbeans/modules/php/editor/api/ElementQuery.java (+2 lines)
Lines 242-247 Link Here
242
242
243
        Set<TypeMemberElement> getAccessibleTypeMembers(TypeElement typeElement, TypeElement calledFromEnclosingType);
243
        Set<TypeMemberElement> getAccessibleTypeMembers(TypeElement typeElement, TypeElement calledFromEnclosingType);
244
244
245
        Set<TypeMemberElement> getAccessibleMixinTypeMembers(TypeElement typeElement, TypeElement calledFromEnclosingType);
246
245
        /**
247
        /**
246
         * @param typeElement
248
         * @param typeElement
247
         * @param insideEnclosingType false means that private, protected elements are filtered. True
249
         * @param insideEnclosingType false means that private, protected elements are filtered. True
(-)a/php.editor/src/org/netbeans/modules/php/editor/api/elements/AliasedClass.java (+5 lines)
Lines 86-91 Link Here
86
    }
86
    }
87
87
88
    @Override
88
    @Override
89
    public Collection<QualifiedName> getFQMixinClassNames() {
90
        return getClassElement().getFQMixinClassNames();
91
    }
92
93
    @Override
89
    public Collection<QualifiedName> getUsedTraits() {
94
    public Collection<QualifiedName> getUsedTraits() {
90
        return getClassElement().getUsedTraits();
95
        return getClassElement().getUsedTraits();
91
    }
96
    }
(-)a/php.editor/src/org/netbeans/modules/php/editor/api/elements/ClassElement.java (+1 lines)
Lines 56-61 Link Here
56
    @CheckForNull
56
    @CheckForNull
57
    QualifiedName getSuperClassName();
57
    QualifiedName getSuperClassName();
58
    Collection<QualifiedName> getPossibleFQSuperClassNames();
58
    Collection<QualifiedName> getPossibleFQSuperClassNames();
59
    Collection<QualifiedName> getFQMixinClassNames();
59
    boolean isFinal();
60
    boolean isFinal();
60
    boolean isAbstract();
61
    boolean isAbstract();
61
    boolean isAnonymous();
62
    boolean isAnonymous();
(-)a/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java (-1 / +12 lines)
Lines 125-130 Link Here
125
import org.netbeans.modules.php.editor.model.impl.Type;
125
import org.netbeans.modules.php.editor.model.impl.Type;
126
import org.netbeans.modules.php.editor.model.impl.VariousUtils;
126
import org.netbeans.modules.php.editor.model.impl.VariousUtils;
127
import org.netbeans.modules.php.editor.NavUtils;
127
import org.netbeans.modules.php.editor.NavUtils;
128
import org.netbeans.modules.php.editor.api.elements.TypeMemberElement;
128
import org.netbeans.modules.php.editor.options.CodeCompletionPanel.VariablesScope;
129
import org.netbeans.modules.php.editor.options.CodeCompletionPanel.VariablesScope;
129
import org.netbeans.modules.php.editor.options.OptionsUtils;
130
import org.netbeans.modules.php.editor.options.OptionsUtils;
130
import org.netbeans.modules.php.editor.parser.PHPParseResult;
131
import org.netbeans.modules.php.editor.parser.PHPParseResult;
Lines 1183-1189 Link Here
1183
                            ElementFilter.forKind(PhpElementKind.TYPE_CONSTANT),
1184
                            ElementFilter.forKind(PhpElementKind.TYPE_CONSTANT),
1184
                            ElementFilter.forName(NameKind.caseInsensitivePrefix(request.prefix)),
1185
                            ElementFilter.forName(NameKind.caseInsensitivePrefix(request.prefix)),
1185
                            ElementFilter.forInstanceOf(TypeConstantElement.class));
1186
                            ElementFilter.forInstanceOf(TypeConstantElement.class));
1186
                    for (final PhpElement phpElement : request.index.getAccessibleTypeMembers(typeScope, enclosingType)) {
1187
                    HashSet<TypeMemberElement> accessibleTypeMembers = new HashSet<>();
1188
                    accessibleTypeMembers.addAll(request.index.getAccessibleTypeMembers(typeScope, enclosingType));
1189
                    // for @mixin tag #241740
1190
                    if (typeScope instanceof ClassElement) {
1191
                        ClassElement classElement = (ClassElement) typeScope;
1192
                        if (!classElement.getFQMixinClassNames().isEmpty()) {
1193
                            // XXX currently, only when mixins are used directly in the class. should support all cases?
1194
                            accessibleTypeMembers.addAll(request.index.getAccessibleMixinTypeMembers(typeScope, enclosingType));
1195
                        }
1196
                    }
1197
                    for (final PhpElement phpElement : accessibleTypeMembers) {
1187
                        if (CancelSupport.getDefault().isCancelled()) {
1198
                        if (CancelSupport.getDefault().isCancelled()) {
1188
                            return;
1199
                            return;
1189
                        }
1200
                        }
(-)a/php.editor/src/org/netbeans/modules/php/editor/elements/ClassElementImpl.java (-6 / +36 lines)
Lines 72-79 Link Here
72
    public static final String IDX_FIELD = PHPIndexer.FIELD_CLASS;
72
    public static final String IDX_FIELD = PHPIndexer.FIELD_CLASS;
73
73
74
    private final QualifiedName superClass;
74
    private final QualifiedName superClass;
75
    private Collection<QualifiedName> possibleFQSuperClassNames;
75
    private final Collection<QualifiedName> possibleFQSuperClassNames;
76
    private Collection<QualifiedName> usedTraits;
76
    private final Collection<QualifiedName> fqMixinClassNames;
77
    private final Collection<QualifiedName> usedTraits;
77
78
78
    private ClassElementImpl(
79
    private ClassElementImpl(
79
            final QualifiedName qualifiedName,
80
            final QualifiedName qualifiedName,
Lines 86-96 Link Here
86
            final Collection<QualifiedName> usedTraits,
87
            final Collection<QualifiedName> usedTraits,
87
            final String fileUrl,
88
            final String fileUrl,
88
            final ElementQuery elementQuery,
89
            final ElementQuery elementQuery,
89
            final boolean isDeprecated) {
90
            final boolean isDeprecated,
91
            final Collection<QualifiedName> fqMixinClassNames) {
90
        super(qualifiedName, offset, ifaceNames, fqSuperInterfaces, flags, fileUrl, elementQuery, isDeprecated);
92
        super(qualifiedName, offset, ifaceNames, fqSuperInterfaces, flags, fileUrl, elementQuery, isDeprecated);
91
        this.superClass = superClsName;
93
        this.superClass = superClsName;
92
        this.possibleFQSuperClassNames = possibleFQSuperClassNames;
94
        this.possibleFQSuperClassNames = possibleFQSuperClassNames;
93
        this.usedTraits = usedTraits;
95
        this.usedTraits = usedTraits;
96
        this.fqMixinClassNames = fqMixinClassNames;
94
    }
97
    }
95
98
96
    public static Set<ClassElement> fromSignature(final IndexQueryImpl indexScopeQuery, final IndexResult indexResult) {
99
    public static Set<ClassElement> fromSignature(final IndexQueryImpl indexScopeQuery, final IndexResult indexResult) {
Lines 120-126 Link Here
120
                    signParser.getSuperClassName(), signParser.getPossibleFQSuperClassName(),
123
                    signParser.getSuperClassName(), signParser.getPossibleFQSuperClassName(),
121
                    signParser.getSuperInterfaces(), signParser.getFQSuperInterfaces(), signParser.getFlags(),
124
                    signParser.getSuperInterfaces(), signParser.getFQSuperInterfaces(), signParser.getFlags(),
122
                    signParser.getUsedTraits(), signParser.getFileUrl(), indexScopeQuery,
125
                    signParser.getUsedTraits(), signParser.getFileUrl(), indexScopeQuery,
123
                    signParser.isDeprecated());
126
                    signParser.isDeprecated(), signParser.getFQMixinClassNames());
124
        }
127
        }
125
        return retval;
128
        return retval;
126
    }
129
    }
Lines 130-140 Link Here
130
        Parameters.notNull("fileQuery", fileQuery);
133
        Parameters.notNull("fileQuery", fileQuery);
131
        ClassDeclarationInfo info = ClassDeclarationInfo.create(node);
134
        ClassDeclarationInfo info = ClassDeclarationInfo.create(node);
132
        final QualifiedName fullyQualifiedName = namespace != null ? namespace.getFullyQualifiedName() : QualifiedName.createForDefaultNamespaceName();
135
        final QualifiedName fullyQualifiedName = namespace != null ? namespace.getFullyQualifiedName() : QualifiedName.createForDefaultNamespaceName();
136
        // XXX mixin
133
        return new ClassElementImpl(
137
        return new ClassElementImpl(
134
                fullyQualifiedName.append(info.getName()), info.getRange().getStart(),
138
                fullyQualifiedName.append(info.getName()), info.getRange().getStart(),
135
                info.getSuperClassName(), Collections.<QualifiedName>emptySet(), info.getInterfaceNames(),
139
                info.getSuperClassName(), Collections.<QualifiedName>emptySet(), info.getInterfaceNames(),
136
                Collections.<QualifiedName>emptySet(), info.getAccessModifiers().toFlags(), info.getUsedTraits(),
140
                Collections.<QualifiedName>emptySet(), info.getAccessModifiers().toFlags(), info.getUsedTraits(),
137
                fileQuery.getURL().toExternalForm(), fileQuery, VariousUtils.isDeprecatedFromPHPDoc(fileQuery.getResult().getProgram(), node));
141
                fileQuery.getURL().toExternalForm(), fileQuery, VariousUtils.isDeprecatedFromPHPDoc(fileQuery.getResult().getProgram(), node),
142
                Collections.<QualifiedName>emptySet());
138
    }
143
    }
139
144
140
    public static ClassElement fromFrameworks(final PhpClass clz, final ElementQuery elementQuery) {
145
    public static ClassElement fromFrameworks(final PhpClass clz, final ElementQuery elementQuery) {
Lines 143-149 Link Here
143
        String fullyQualifiedName = clz.getFullyQualifiedName();
148
        String fullyQualifiedName = clz.getFullyQualifiedName();
144
        ClassElementImpl retval = new ClassElementImpl(QualifiedName.create(fullyQualifiedName == null ? clz.getName() : fullyQualifiedName),
149
        ClassElementImpl retval = new ClassElementImpl(QualifiedName.create(fullyQualifiedName == null ? clz.getName() : fullyQualifiedName),
145
                clz.getOffset(), null, Collections.<QualifiedName>emptySet(), Collections.<QualifiedName>emptySet(),
150
                clz.getOffset(), null, Collections.<QualifiedName>emptySet(), Collections.<QualifiedName>emptySet(),
146
                Collections.<QualifiedName>emptySet(), PhpModifiers.NO_FLAGS, Collections.<QualifiedName>emptySet(), null, elementQuery, false);
151
                Collections.<QualifiedName>emptySet(), PhpModifiers.NO_FLAGS, Collections.<QualifiedName>emptySet(), null, elementQuery, false,
152
                Collections.<QualifiedName>emptySet());
147
        retval.setFileObject(clz.getFile());
153
        retval.setFileObject(clz.getFile());
148
        return retval;
154
        return retval;
149
    }
155
    }
Lines 169-174 Link Here
169
    }
175
    }
170
176
171
    @Override
177
    @Override
178
    public Collection<QualifiedName> getFQMixinClassNames() {
179
        return Collections.unmodifiableCollection(fqMixinClassNames);
180
    }
181
182
    @Override
172
    public String getSignature() {
183
    public String getSignature() {
173
        StringBuilder sb = new StringBuilder();
184
        StringBuilder sb = new StringBuilder();
174
        sb.append(getName().toLowerCase()).append(Separator.SEMICOLON); //NOI18N
185
        sb.append(getName().toLowerCase()).append(Separator.SEMICOLON); //NOI18N
Lines 214-219 Link Here
214
        sb.append(";"); //NOI18N
225
        sb.append(";"); //NOI18N
215
        sb.append(isDeprecated() ? 1 : 0).append(";"); //NOI18N
226
        sb.append(isDeprecated() ? 1 : 0).append(";"); //NOI18N
216
        sb.append(getFilenameUrl()).append(Separator.SEMICOLON);
227
        sb.append(getFilenameUrl()).append(Separator.SEMICOLON);
228
        StringBuilder mixinSb = new StringBuilder();
229
        fqMixinClassNames.forEach((mixinClassName) -> {
230
            if (mixinSb.length() > 0) {
231
                mixinSb.append(Separator.COMMA);
232
            }
233
            mixinSb.append(mixinClassName.toString());
234
        });
235
        sb.append(mixinSb.toString());
236
        sb.append(Separator.SEMICOLON);
217
        checkClassSignature(sb);
237
        checkClassSignature(sb);
218
        return sb.toString();
238
        return sb.toString();
219
    }
239
    }
Lines 393-397 Link Here
393
        String getFileUrl() {
413
        String getFileUrl() {
394
            return signature.string(9);
414
            return signature.string(9);
395
        }
415
        }
416
417
        public Collection<QualifiedName> getFQMixinClassNames() {
418
            Collection<QualifiedName> retval = new HashSet<>();
419
            String mixins = signature.string(10);
420
            final String[] mixinNames = mixins.split(Separator.COMMA.toString());
421
            for (String mixinName : mixinNames) {
422
                retval.add(QualifiedName.create(mixinName));
423
            }
424
            return retval;
425
        }
396
    }
426
    }
397
}
427
}
(-)a/php.editor/src/org/netbeans/modules/php/editor/elements/IndexQueryImpl.java (-31 / +89 lines)
Lines 1039-1079 Link Here
1039
            EnumSet<PhpElementKind> typeKinds, EnumSet<PhpElementKind> memberKinds) {
1039
            EnumSet<PhpElementKind> typeKinds, EnumSet<PhpElementKind> memberKinds) {
1040
        final Set<TypeMemberElement> directTypes = new LinkedHashSet<>();
1040
        final Set<TypeMemberElement> directTypes = new LinkedHashSet<>();
1041
        if (typeKinds.contains(PhpElementKind.CLASS) && (typeElement instanceof ClassElement)) {
1041
        if (typeKinds.contains(PhpElementKind.CLASS) && (typeElement instanceof ClassElement)) {
1042
            final Set<TypeMemberElement> classTypes = new LinkedHashSet<>();
1042
            ClassElement classElement = (ClassElement) typeElement;
1043
            QualifiedName superClassName;
1043
            QualifiedName superClassName;
1044
            Collection<QualifiedName> possibleFQSuperClassNames = ((ClassElement) typeElement).getPossibleFQSuperClassNames();
1044
            Collection<QualifiedName> possibleFQSuperClassNames = classElement.getPossibleFQSuperClassNames();
1045
            if (possibleFQSuperClassNames.size() == 1) {
1045
            if (possibleFQSuperClassNames.size() == 1) {
1046
                superClassName = possibleFQSuperClassNames.iterator().next();
1046
                superClassName = possibleFQSuperClassNames.iterator().next();
1047
            } else {
1047
            } else {
1048
                superClassName = ((ClassElement) typeElement).getSuperClassName();
1048
                superClassName = classElement.getSuperClassName();
1049
            }
1049
            }
1050
            if (superClassName != null) {
1050
            Set<TypeMemberElement> classTypes = getDirectInheritedClassTypes(superClassName, memberKinds, typeElement);
1051
                classTypes.addAll(extendedQuery.getFields(NameKind.exact(superClassName), NameKind.empty()));
1052
                classTypes.addAll(extendedQuery.getMethods(NameKind.exact(superClassName), NameKind.empty()));
1053
                classTypes.addAll(extendedQuery.getTypeConstants(NameKind.exact(superClassName), NameKind.empty()));
1054
                if (memberKinds.size() != 1) {
1055
                    classTypes.addAll(ElementFilter.forFiles(typeElement.getFileObject()).prefer(getTypeMembers(NameKind.exact(superClassName), NameKind.empty())));
1056
                } else {
1057
                    switch(memberKinds.iterator().next()) {
1058
                        case METHOD:
1059
                            classTypes.addAll(ElementFilter.forFiles(typeElement.getFileObject()).prefer(
1060
                                    getMethodsImpl(NameKind.exact(superClassName), NameKind.empty(), EnumSet.of(PhpElementKind.CLASS))));
1061
                            break;
1062
                        case FIELD:
1063
                            classTypes.addAll(ElementFilter.forFiles(typeElement.getFileObject()).prefer(getFields(NameKind.exact(superClassName), NameKind.empty())));
1064
                            break;
1065
                        case TYPE_CONSTANT:
1066
                            classTypes.addAll(ElementFilter.forFiles(typeElement.getFileObject()).prefer(
1067
                                    getTypeConstantsImpl(NameKind.exact(superClassName), NameKind.empty(), EnumSet.of(PhpElementKind.CLASS))));
1068
                            break;
1069
                        default:
1070
                            //no-op
1071
                    }
1072
                }
1073
                if (classTypes.isEmpty()) {
1074
                    insertEmptyElement(classTypes, getClasses(NameKind.exact(superClassName)));
1075
                }
1076
            }
1077
            directTypes.addAll(classTypes);
1051
            directTypes.addAll(classTypes);
1078
        }
1052
        }
1079
        if (typeKinds.contains(PhpElementKind.IFACE)) {
1053
        if (typeKinds.contains(PhpElementKind.IFACE)) {
Lines 1140-1145 Link Here
1140
        return directTypes;
1114
        return directTypes;
1141
    }
1115
    }
1142
1116
1117
    private Set<TypeMemberElement> getDirectMixinTypeMembers(final TypeElement typeElement,
1118
            EnumSet<PhpElementKind> typeKinds, EnumSet<PhpElementKind> memberKinds) {
1119
        final Set<TypeMemberElement> directTypes = new LinkedHashSet<>();
1120
        if (typeKinds.contains(PhpElementKind.CLASS) && (typeElement instanceof ClassElement)) {
1121
            ClassElement classElement = (ClassElement) typeElement;
1122
            Collection<QualifiedName> mixinNames = classElement.getFQMixinClassNames();
1123
            mixinNames.stream()
1124
                    .map(mixinName -> getDirectInheritedClassTypes(mixinName, memberKinds, typeElement))
1125
                    .forEach(classTypes -> directTypes.addAll(classTypes));
1126
        }
1127
        return directTypes;
1128
    }
1129
1130
    private Set<TypeMemberElement> getDirectInheritedClassTypes(QualifiedName superClassName, EnumSet<PhpElementKind> memberKinds, final TypeElement typeElement) {
1131
        final Set<TypeMemberElement> classTypes = new LinkedHashSet<>();
1132
        if (superClassName != null) {
1133
            classTypes.addAll(extendedQuery.getFields(NameKind.exact(superClassName), NameKind.empty()));
1134
            classTypes.addAll(extendedQuery.getMethods(NameKind.exact(superClassName), NameKind.empty()));
1135
            classTypes.addAll(extendedQuery.getTypeConstants(NameKind.exact(superClassName), NameKind.empty()));
1136
            if (memberKinds.size() != 1) {
1137
                classTypes.addAll(ElementFilter.forFiles(typeElement.getFileObject()).prefer(getTypeMembers(NameKind.exact(superClassName), NameKind.empty())));
1138
            } else {
1139
                switch (memberKinds.iterator().next()) {
1140
                    case METHOD:
1141
                        classTypes.addAll(ElementFilter.forFiles(typeElement.getFileObject()).prefer(
1142
                                getMethodsImpl(NameKind.exact(superClassName), NameKind.empty(), EnumSet.of(PhpElementKind.CLASS))));
1143
                        break;
1144
                    case FIELD:
1145
                        classTypes.addAll(ElementFilter.forFiles(typeElement.getFileObject()).prefer(getFields(NameKind.exact(superClassName), NameKind.empty())));
1146
                        break;
1147
                    case TYPE_CONSTANT:
1148
                        classTypes.addAll(ElementFilter.forFiles(typeElement.getFileObject()).prefer(
1149
                                getTypeConstantsImpl(NameKind.exact(superClassName), NameKind.empty(), EnumSet.of(PhpElementKind.CLASS))));
1150
                        break;
1151
                    default:
1152
                    //no-op
1153
                }
1154
            }
1155
            if (classTypes.isEmpty()) {
1156
                insertEmptyElement(classTypes, getClasses(NameKind.exact(superClassName)));
1157
            }
1158
        }
1159
        return classTypes;
1160
    }
1161
1143
    private void insertEmptyElement(final Set<TypeMemberElement> where, final Set<? extends TypeElement> exactTypeName) {
1162
    private void insertEmptyElement(final Set<TypeMemberElement> where, final Set<? extends TypeElement> exactTypeName) {
1144
        TypeElement exactType = ModelUtils.getFirst(exactTypeName);
1163
        TypeElement exactType = ModelUtils.getFirst(exactTypeName);
1145
        if (exactType != null) {
1164
        if (exactType != null) {
Lines 1243-1248 Link Here
1243
                new LinkedHashSet<>(getDeclaredTypeMembers(typeElement)), typeKinds, memberKinds);
1262
                new LinkedHashSet<>(getDeclaredTypeMembers(typeElement)), typeKinds, memberKinds);
1244
    }
1263
    }
1245
1264
1265
    private Set<TypeMemberElement> getAllMixinTypeMembers(TypeElement typeElement) {
1266
        final EnumSet<PhpElementKind> typeKinds = EnumSet.of(PhpElementKind.CLASS);
1267
        final EnumSet<PhpElementKind> memberKinds = EnumSet.of(
1268
                PhpElementKind.METHOD,
1269
                PhpElementKind.FIELD,
1270
                PhpElementKind.TYPE_CONSTANT
1271
        );
1272
        return getMixinTypeMembers(typeElement, new LinkedHashSet<>(),
1273
                new LinkedHashSet<>(getDeclaredTypeMembers(typeElement)), typeKinds, memberKinds);
1274
    }
1275
1246
    @Override
1276
    @Override
1247
    public Set<TypeMemberElement> getInheritedTypeMembers(final TypeElement typeElement) {
1277
    public Set<TypeMemberElement> getInheritedTypeMembers(final TypeElement typeElement) {
1248
        final EnumSet<PhpElementKind> typeKinds = EnumSet.of(
1278
        final EnumSet<PhpElementKind> typeKinds = EnumSet.of(
Lines 1263-1268 Link Here
1263
    public Set<TypeMemberElement> getAccessibleTypeMembers(TypeElement typeElement, TypeElement calledFromEnclosingType) {
1293
    public Set<TypeMemberElement> getAccessibleTypeMembers(TypeElement typeElement, TypeElement calledFromEnclosingType) {
1264
        final long start = (LOG.isLoggable(Level.FINE)) ? System.currentTimeMillis() : 0;
1294
        final long start = (LOG.isLoggable(Level.FINE)) ? System.currentTimeMillis() : 0;
1265
        final Set<TypeMemberElement> allTypeMembers = getAllTypeMembers(typeElement);
1295
        final Set<TypeMemberElement> allTypeMembers = getAllTypeMembers(typeElement);
1296
        Set<TypeMemberElement> retval = getAccessibleTypeMembers(typeElement, calledFromEnclosingType, allTypeMembers);
1297
        if (LOG.isLoggable(Level.FINE)) {
1298
            logQueryTime("Set<TypeMemberElement> getAccessibleTypeMembers", NameKind.exact(typeElement.getFullyQualifiedName()), start); //NOI18N
1299
        }
1300
        return Collections.unmodifiableSet(retval);
1301
    }
1302
1303
    private Set<TypeMemberElement> getAccessibleTypeMembers(TypeElement typeElement, TypeElement calledFromEnclosingType, final Set<TypeMemberElement> allTypeMembers) {
1266
        Collection<TypeElement> subTypes = Collections.emptySet();
1304
        Collection<TypeElement> subTypes = Collections.emptySet();
1267
        if (calledFromEnclosingType != null) {
1305
        if (calledFromEnclosingType != null) {
1268
            if (typeElement instanceof TraitElement
1306
            if (typeElement instanceof TraitElement
Lines 1275-1282 Link Here
1275
        retval.addAll(filterForAccessible.filter(allTypeMembers));
1313
        retval.addAll(filterForAccessible.filter(allTypeMembers));
1276
        ElementFilter allOf = ElementFilter.allOf(ElementFilter.forVirtualExtensions(), ElementFilter.forMembersOfTypeName(typeElement));
1314
        ElementFilter allOf = ElementFilter.allOf(ElementFilter.forVirtualExtensions(), ElementFilter.forMembersOfTypeName(typeElement));
1277
        retval.addAll(allOf.filter(allTypeMembers));
1315
        retval.addAll(allOf.filter(allTypeMembers));
1316
        return retval;
1317
    }
1318
1319
    @Override
1320
    public Set<TypeMemberElement> getAccessibleMixinTypeMembers(TypeElement typeElement, TypeElement calledFromEnclosingType) {
1321
        final long start = (LOG.isLoggable(Level.FINE)) ? System.currentTimeMillis() : 0;
1322
        final Set<TypeMemberElement> allTypeMembers = getAllMixinTypeMembers(typeElement);
1323
        Set<TypeMemberElement> retval = getAccessibleTypeMembers(typeElement, calledFromEnclosingType, allTypeMembers);
1278
        if (LOG.isLoggable(Level.FINE)) {
1324
        if (LOG.isLoggable(Level.FINE)) {
1279
            logQueryTime("Set<PhpElement> getAccessibleTypeMembers", NameKind.exact(typeElement.getFullyQualifiedName()), start); //NOI18N
1325
            logQueryTime("Set<TypeMemberElement> getAccessibleMixinTypeMembers", NameKind.exact(typeElement.getFullyQualifiedName()), start); // NOI18N
1280
        }
1326
        }
1281
        return Collections.unmodifiableSet(retval);
1327
        return Collections.unmodifiableSet(retval);
1282
    }
1328
    }
Lines 1293-1298 Link Here
1293
        return forPrefereMethodImplementation(retval).filter(retval);
1339
        return forPrefereMethodImplementation(retval).filter(retval);
1294
    }
1340
    }
1295
1341
1342
    private Set<TypeMemberElement> getMixinTypeMembers(final TypeElement typeElement, final Set<TypeElement> recursionPrevention,
1343
            Set<TypeMemberElement> retval, EnumSet<PhpElementKind> typeKinds, EnumSet<PhpElementKind> memberKinds) {
1344
        if (recursionPrevention.add(typeElement)) {
1345
            final Set<TypeMemberElement> typeMembers = getDirectMixinTypeMembers(typeElement, typeKinds, memberKinds);
1346
            retval.addAll(forEmptyElements().filter(forComparingNonAbstractNameKinds(retval).reverseFilter(typeMembers)));
1347
            Set<TypeElement> types = toTypes(typeMembers);
1348
            types.addAll(getDirectInheritedTypes(typeElement));
1349
            types.forEach(type -> retval.addAll(getMixinTypeMembers(type, recursionPrevention, retval, typeKinds, memberKinds)));
1350
        }
1351
        return forPrefereMethodImplementation(retval).filter(retval);
1352
    }
1353
1296
    @Override
1354
    @Override
1297
    public Set<MethodElement> getAllMethods(final Exact typeQuery, final NameKind methodQuery) {
1355
    public Set<MethodElement> getAllMethods(final Exact typeQuery, final NameKind methodQuery) {
1298
        Set<MethodElement> retval = new HashSet<>();
1356
        Set<MethodElement> retval = new HashSet<>();
(-)a/php.editor/src/org/netbeans/modules/php/editor/index/PHPIndexer.java (-1 / +1 lines)
Lines 239-245 Link Here
239
    public static final class Factory extends EmbeddingIndexerFactory {
239
    public static final class Factory extends EmbeddingIndexerFactory {
240
240
241
        public static final String NAME = "php"; // NOI18N
241
        public static final String NAME = "php"; // NOI18N
242
        public static final int VERSION = 27;
242
        public static final int VERSION = 28;
243
243
244
        @Override
244
        @Override
245
        public EmbeddingIndexer createIndexer(final Indexable indexable, final Snapshot snapshot) {
245
        public EmbeddingIndexer createIndexer(final Indexable indexable, final Snapshot snapshot) {
(-)a/php.editor/src/org/netbeans/modules/php/editor/model/impl/ClassScopeImpl.java (+28 lines)
Lines 89-94 Link Here
89
 */
89
 */
90
class ClassScopeImpl extends TypeScopeImpl implements ClassScope, VariableNameFactory {
90
class ClassScopeImpl extends TypeScopeImpl implements ClassScope, VariableNameFactory {
91
    private final Collection<QualifiedName> possibleFQSuperClassNames;
91
    private final Collection<QualifiedName> possibleFQSuperClassNames;
92
    // @GuardedBy("this")
93
    private final Collection<QualifiedName> mixinClassNames = new HashSet<>();
92
    private final Collection<QualifiedName> usedTraits = new HashSet<>();
94
    private final Collection<QualifiedName> usedTraits = new HashSet<>();
93
    private final Set<? super TypeScope> superRecursionDetection = new HashSet<>();
95
    private final Set<? super TypeScope> superRecursionDetection = new HashSet<>();
94
    private final Set<? super TypeScope> subRecursionDetection = new HashSet<>();
96
    private final Set<? super TypeScope> subRecursionDetection = new HashSet<>();
Lines 180-185 Link Here
180
        return this.possibleFQSuperClassNames;
182
        return this.possibleFQSuperClassNames;
181
    }
183
    }
182
184
185
    /**
186
     * Add fully qualified names for @mixin tag.
187
     *
188
     * @param names fully qualified names
189
     */
190
    synchronized void addFQMixinClassNames(Collection<QualifiedName> names) {
191
        mixinClassNames.addAll(names);
192
    }
193
194
    @Override
195
    public synchronized Collection<QualifiedName> getFQMixinClassNames() {
196
        return Collections.unmodifiableCollection(mixinClassNames);
197
    }
198
183
    @NonNull
199
    @NonNull
184
    @Override
200
    @Override
185
    public Collection<? extends ClassScope> getSuperClasses() {
201
    public Collection<? extends ClassScope> getSuperClasses() {
Lines 514-519 Link Here
514
        sb.append(Signature.ITEM_DELIMITER);
530
        sb.append(Signature.ITEM_DELIMITER);
515
        sb.append(isDeprecated() ? 1 : 0).append(Signature.ITEM_DELIMITER);
531
        sb.append(isDeprecated() ? 1 : 0).append(Signature.ITEM_DELIMITER);
516
        sb.append(getFilenameUrl()).append(Signature.ITEM_DELIMITER);
532
        sb.append(getFilenameUrl()).append(Signature.ITEM_DELIMITER);
533
        // mixin
534
        StringBuilder mixinSb = new StringBuilder();
535
        for (QualifiedName mixinClassName : mixinClassNames) {
536
            if (mixinSb.length() > 0) {
537
                mixinSb.append(","); // NOI18N
538
            }
539
            mixinSb.append(mixinClassName.toString());
540
        }
541
        sb.append(mixinSb);
542
        sb.append(Signature.ITEM_DELIMITER);
517
        return sb.toString();
543
        return sb.toString();
518
    }
544
    }
519
545
Lines 541-546 Link Here
541
        QualifiedName qualifiedName = namespaceScope.getQualifiedName();
567
        QualifiedName qualifiedName = namespaceScope.getQualifiedName();
542
        sb.append(qualifiedName.toString()).append(Signature.ITEM_DELIMITER);
568
        sb.append(qualifiedName.toString()).append(Signature.ITEM_DELIMITER);
543
        sb.append(isDeprecated() ? 1 : 0).append(Signature.ITEM_DELIMITER);
569
        sb.append(isDeprecated() ? 1 : 0).append(Signature.ITEM_DELIMITER);
570
        sb.append(getFilenameUrl()).append(Signature.ITEM_DELIMITER);
571
        sb.append(Signature.ITEM_DELIMITER); // mixin
544
572
545
        return sb.toString();
573
        return sb.toString();
546
574
(-)a/php.editor/src/org/netbeans/modules/php/editor/model/impl/ModelVisitor.java (+18 lines)
Lines 1200-1205 Link Here
1200
1200
1201
    @Override
1201
    @Override
1202
    public void visit(PHPDocTypeTag node) {
1202
    public void visit(PHPDocTypeTag node) {
1203
        // #241740 for @mixin tag
1204
        if (node.getKind().equals(PHPDocTag.Type.MIXIN)) {
1205
            Scope currentScope = modelBuilder.getCurrentScope();
1206
            if (currentScope instanceof ClassScopeImpl) {
1207
                ClassScopeImpl classScope = (ClassScopeImpl) currentScope;
1208
                List<? extends PhpDocTypeTagInfo> tagInfos = PhpDocTypeTagInfo.create(node, classScope);
1209
                Set<QualifiedName> names = new HashSet<>();
1210
                tagInfos.stream()
1211
                        .filter(tagInfo -> !tagInfo.getName().isEmpty())
1212
                        .map(tagInfo -> tagInfo.getTypeName())
1213
                        .filter(typeName -> (typeName != null && !typeName.isEmpty()))
1214
                        .map(typeName -> VariousUtils.qualifyTypeNames(typeName, node.getStartOffset(), classScope))
1215
                        .forEach(qualifiedTypeName -> names.add(QualifiedName.create(qualifiedTypeName)));
1216
                if (!names.isEmpty()) {
1217
                    classScope.addFQMixinClassNames(names);
1218
                }
1219
            }
1220
        }
1203
        occurencesBuilder.prepare(node, modelBuilder.getCurrentScope());
1221
        occurencesBuilder.prepare(node, modelBuilder.getCurrentScope());
1204
        super.visit(node);
1222
        super.visit(node);
1205
    }
1223
    }
(-)a/php.editor/src/org/netbeans/modules/php/editor/parser/PHPDocCommentParser.java (-1 / +1 lines)
Lines 255-261 Link Here
255
                    }
255
                    }
256
                }
256
                }
257
                return null;
257
                return null;
258
            } else if (type.equals(PHPDocTag.Type.RETURN) || type.equals(PHPDocTag.Type.VAR)) {
258
            } else if (type.equals(PHPDocTag.Type.RETURN) || type.equals(PHPDocTag.Type.VAR) || type.equals(PHPDocTag.Type.MIXIN)) {
259
                return new PHPDocTypeTag(start, end, type, description, docTypes);
259
                return new PHPDocTypeTag(start, end, type, description, docTypes);
260
            }
260
            }
261
            return new PHPDocTag(start, end, type, description);
261
            return new PHPDocTag(start, end, type, description);
(-)a/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/PHPDocTag.java (+1 lines)
Lines 59-64 Link Here
59
        PARAM("param"), //NOI18N
59
        PARAM("param"), //NOI18N
60
        RETURN("return"), //NOI18N
60
        RETURN("return"), //NOI18N
61
        VAR("var"), //NOI18N
61
        VAR("var"), //NOI18N
62
        MIXIN("mixin"), // NOI18N
62
        DEPRECATED("deprecated"); //NOI18N
63
        DEPRECATED("deprecated"); //NOI18N
63
64
64
        private final String name;
65
        private final String name;
(-)a/php.editor/test/unit/data/testfiles/completion/lib/mixin/mixin.php (+226 lines)
Line 0 Link Here
1
<?php
2
3
/**
4
 * @mixin C2
5
 */
6
class C1
7
{
8
    public const PUBLIC_CONST_C1 = "PUBLIC_CONST_C1";
9
    private const PRIVATE_CONST_C1 = "PRIVATE_CONST_C1";
10
    protected const PROTECTED_CONST_C1 = "PROTECTED_CONST_C1";
11
12
    public $publicFieldC1;
13
    private $privateFieldC1;
14
    protected $protectedFieldC1;
15
16
    public static $publicStaticFieldC1;
17
    private static $privateStaticFieldC1;
18
    protected static $protectedStaticFieldC1;
19
20
    public function publicMethodC1()
21
    {
22
    }
23
24
    private function privateMethodC1()
25
    {
26
    }
27
28
    protected function protectedMethodC1()
29
    {
30
    }
31
32
    public static function publicStaticMethodC1()
33
    {
34
    }
35
36
    private static function privateStaticMethodC1()
37
    {
38
    }
39
40
    protected static function protectedStaticMethodC1()
41
    {
42
    }
43
}
44
45
class C2
46
{
47
    public const PUBLIC_CONST_C2 = "PUBLIC_CONST_C2";
48
    private const PRIVATE_CONST_C2 = "PRIVATE_CONST_C2";
49
    protected const PROTECTED_CONST_C2 = "PROTECTED_CONST_C2";
50
51
    public $publicFieldC2;
52
    private $privateFieldC2;
53
    protected $protectedFieldC2;
54
55
    public static $publicStaticFieldC2;
56
    private static $privateStaticFieldC2;
57
    protected static $protectedStaticFieldC2;
58
59
    public function publicMethodC2()
60
    {
61
    }
62
63
    private function privateMethodC2()
64
    {
65
    }
66
67
    protected function protectedMethodC2()
68
    {
69
    }
70
71
    public static function publicStaticMethodC2()
72
    {
73
    }
74
75
    private static function privateStaticMethodC2()
76
    {
77
    }
78
79
    protected static function protectedStaticMethodC2()
80
    {
81
    }
82
}
83
84
class C3
85
{
86
    public const PUBLIC_CONST_C3 = "PUBLIC_CONST_C3";
87
    private const PRIVATE_CONST_C3 = "PRIVATE_CONST_C3";
88
    protected const PROTECTED_CONST_C3 = "PROTECTED_CONST_C3";
89
90
    public $publicFieldC3;
91
    private $privateFieldC3;
92
    protected $protectedFieldC3;
93
94
    public static $publicStaticFieldC3;
95
    private static $privateStaticFieldC3;
96
    protected static $protectedStaticFieldC3;
97
98
    public function publicMethodC3()
99
    {
100
    }
101
102
    private function privateMethodC3()
103
    {
104
    }
105
106
    protected function protectedMethodC3()
107
    {
108
    }
109
110
    public static function publicStaticMethodC3()
111
    {
112
    }
113
114
    private static function privateStaticMethodC3()
115
    {
116
    }
117
118
    protected static function protectedStaticMethodC3()
119
    {
120
    }
121
}
122
123
class C4
124
{
125
    public const PUBLIC_CONST_C4 = "PUBLIC_CONST_C4";
126
    private const PRIVATE_CONST_C4 = "PRIVATE_CONST_C4";
127
    protected const PROTECTED_CONST_C4 = "PROTECTED_CONST_C4";
128
129
    public $publicFieldC4;
130
    private $privateFieldC4;
131
    protected $protectedFieldC4;
132
133
    public static $publicStaticFieldC4;
134
    private static $privateStaticFieldC4;
135
    protected static $protectedStaticFieldC4;
136
137
    public function publicMethodC4()
138
    {
139
    }
140
141
    private function privateMethodC4()
142
    {
143
    }
144
145
    protected function protectedMethodC4()
146
    {
147
    }
148
149
    public static function publicStaticMethodC4()
150
    {
151
    }
152
153
    private static function privateStaticMethodC4()
154
    {
155
    }
156
157
    protected static function protectedStaticMethodC4()
158
    {
159
    }
160
}
161
162
class C5
163
{
164
    public const PUBLIC_CONST_C5 = "PUBLIC_CONST_C5";
165
    private const PRIVATE_CONST_C5 = "PRIVATE_CONST_C5";
166
    protected const PROTECTED_CONST_C5 = "PROTECTED_CONST_C5";
167
168
    public $publicFieldC5;
169
    private $privateFieldC5;
170
    protected $protectedFieldC5;
171
172
    public static $publicStaticFieldC5;
173
    private static $privateStaticFieldC5;
174
    protected static $protectedStaticFieldC5;
175
176
    public function publicMethodC5()
177
    {
178
    }
179
180
    private function privateMethodC5()
181
    {
182
    }
183
184
    protected function protectedMethodC5()
185
    {
186
    }
187
188
    public static function publicStaticMethodC5()
189
    {
190
    }
191
192
    private static function privateStaticMethodC5()
193
    {
194
    }
195
196
    protected static function protectedStaticMethodC5()
197
    {
198
    }
199
}
200
201
/**
202
 * @mixin C3
203
 */
204
class MixinParent
205
{
206
    public function testParent()
207
    {
208
    }
209
}
210
211
/**
212
 * @mixin C1
213
 * @mixin C4|C5
214
 */
215
class Mixin extends MixinParent
216
{
217
    public function test()
218
    {
219
        $this->protectedMethodC1(); // CC
220
        Mixin::protectedStaticMethodC1(); // CC
221
    }
222
}
223
224
$mixin = new Mixin();
225
$mixin->publicMethodC1(); // CC
226
Mixin::publicStaticMethodC1(); // CC
(-)a/php.editor/test/unit/data/testfiles/completion/lib/mixin/mixin.php.testMixin.completion (+20 lines)
Line 0 Link Here
1
Code completion result for source line:
2
$mixin->|publicMethodC1(); // CC
3
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
4
METHOD     publicMethodC1()                [PUBLIC]   C1
5
METHOD     publicMethodC2()                [PUBLIC]   C2
6
METHOD     publicMethodC3()                [PUBLIC]   C3
7
METHOD     publicMethodC4()                [PUBLIC]   C4
8
METHOD     publicMethodC5()                [PUBLIC]   C5
9
METHOD     publicStaticMethodC1()          [STATIC]   C1
10
METHOD     publicStaticMethodC2()          [STATIC]   C2
11
METHOD     publicStaticMethodC3()          [STATIC]   C3
12
METHOD     publicStaticMethodC4()          [STATIC]   C4
13
METHOD     publicStaticMethodC5()          [STATIC]   C5
14
METHOD     test()                          [PUBLIC]   Mixin
15
METHOD     testParent()                    [PUBLIC]   MixinParent
16
VARIABLE   ? publicFieldC1                 [PUBLIC]   C1
17
VARIABLE   ? publicFieldC2                 [PUBLIC]   C2
18
VARIABLE   ? publicFieldC3                 [PUBLIC]   C3
19
VARIABLE   ? publicFieldC4                 [PUBLIC]   C4
20
VARIABLE   ? publicFieldC5                 [PUBLIC]   C5
(-)a/php.editor/test/unit/data/testfiles/completion/lib/mixin/mixin.php.testMixinEnclosing.completion (+35 lines)
Line 0 Link Here
1
Code completion result for source line:
2
$this->|protectedMethodC1(); // CC
3
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
4
METHOD     protectedMethodC1()             [PROTECTE  C1
5
METHOD     protectedMethodC2()             [PROTECTE  C2
6
METHOD     protectedMethodC3()             [PROTECTE  C3
7
METHOD     protectedMethodC4()             [PROTECTE  C4
8
METHOD     protectedMethodC5()             [PROTECTE  C5
9
METHOD     protectedStaticMethodC1()       [PROTECTE  C1
10
METHOD     protectedStaticMethodC2()       [PROTECTE  C2
11
METHOD     protectedStaticMethodC3()       [PROTECTE  C3
12
METHOD     protectedStaticMethodC4()       [PROTECTE  C4
13
METHOD     protectedStaticMethodC5()       [PROTECTE  C5
14
METHOD     publicMethodC1()                [PUBLIC]   C1
15
METHOD     publicMethodC2()                [PUBLIC]   C2
16
METHOD     publicMethodC3()                [PUBLIC]   C3
17
METHOD     publicMethodC4()                [PUBLIC]   C4
18
METHOD     publicMethodC5()                [PUBLIC]   C5
19
METHOD     publicStaticMethodC1()          [STATIC]   C1
20
METHOD     publicStaticMethodC2()          [STATIC]   C2
21
METHOD     publicStaticMethodC3()          [STATIC]   C3
22
METHOD     publicStaticMethodC4()          [STATIC]   C4
23
METHOD     publicStaticMethodC5()          [STATIC]   C5
24
METHOD     test()                          [PUBLIC]   Mixin
25
METHOD     testParent()                    [PUBLIC]   MixinParent
26
VARIABLE   ? protectedFieldC1              [PROTECTE  C1
27
VARIABLE   ? protectedFieldC2              [PROTECTE  C2
28
VARIABLE   ? protectedFieldC3              [PROTECTE  C3
29
VARIABLE   ? protectedFieldC4              [PROTECTE  C4
30
VARIABLE   ? protectedFieldC5              [PROTECTE  C5
31
VARIABLE   ? publicFieldC1                 [PUBLIC]   C1
32
VARIABLE   ? publicFieldC2                 [PUBLIC]   C2
33
VARIABLE   ? publicFieldC3                 [PUBLIC]   C3
34
VARIABLE   ? publicFieldC4                 [PUBLIC]   C4
35
VARIABLE   ? publicFieldC5                 [PUBLIC]   C5
(-)a/php.editor/test/unit/data/testfiles/completion/lib/mixin/mixin.php.testMixinEnclosingWithStaticAccess.completion (+34 lines)
Line 0 Link Here
1
Code completion result for source line:
2
Mixin::|protectedStaticMethodC1(); // CC
3
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
4
METHOD     protectedStaticMethodC1()       [PROTECTE  C1
5
METHOD     protectedStaticMethodC2()       [PROTECTE  C2
6
METHOD     protectedStaticMethodC3()       [PROTECTE  C3
7
METHOD     protectedStaticMethodC4()       [PROTECTE  C4
8
METHOD     protectedStaticMethodC5()       [PROTECTE  C5
9
METHOD     publicStaticMethodC1()          [STATIC]   C1
10
METHOD     publicStaticMethodC2()          [STATIC]   C2
11
METHOD     publicStaticMethodC3()          [STATIC]   C3
12
METHOD     publicStaticMethodC4()          [STATIC]   C4
13
METHOD     publicStaticMethodC5()          [STATIC]   C5
14
VARIABLE   ? $protectedStaticFieldC1       [PROTECTE  C1
15
VARIABLE   ? $protectedStaticFieldC2       [PROTECTE  C2
16
VARIABLE   ? $protectedStaticFieldC3       [PROTECTE  C3
17
VARIABLE   ? $protectedStaticFieldC4       [PROTECTE  C4
18
VARIABLE   ? $protectedStaticFieldC5       [PROTECTE  C5
19
VARIABLE   ? $publicStaticFieldC1          [STATIC]   C1
20
VARIABLE   ? $publicStaticFieldC2          [STATIC]   C2
21
VARIABLE   ? $publicStaticFieldC3          [STATIC]   C3
22
VARIABLE   ? $publicStaticFieldC4          [STATIC]   C4
23
VARIABLE   ? $publicStaticFieldC5          [STATIC]   C5
24
CONSTANT   PROTECTED_CONST_C1 "PROTECTED_  [PROTECTE  C1
25
CONSTANT   PROTECTED_CONST_C2 "PROTECTED_  [PROTECTE  C2
26
CONSTANT   PROTECTED_CONST_C3 "PROTECTED_  [PROTECTE  C3
27
CONSTANT   PROTECTED_CONST_C4 "PROTECTED_  [PROTECTE  C4
28
CONSTANT   PROTECTED_CONST_C5 "PROTECTED_  [PROTECTE  C5
29
CONSTANT   PUBLIC_CONST_C1 "PUBLIC_CONST_  [PUBLIC]   C1
30
CONSTANT   PUBLIC_CONST_C2 "PUBLIC_CONST_  [PUBLIC]   C2
31
CONSTANT   PUBLIC_CONST_C3 "PUBLIC_CONST_  [PUBLIC]   C3
32
CONSTANT   PUBLIC_CONST_C4 "PUBLIC_CONST_  [PUBLIC]   C4
33
CONSTANT   PUBLIC_CONST_C5 "PUBLIC_CONST_  [PUBLIC]   C5
34
CONSTANT   class \Mixin                    [PUBLIC]   Magic Constant
(-)a/php.editor/test/unit/data/testfiles/completion/lib/mixin/mixin.php.testMixinTagType.completion (+30 lines)
Line 0 Link Here
1
Code completion result for source line:
2
* @mixin |C3
3
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
4
CLASS      C1                              [PUBLIC]   mixin.php
5
CLASS      C2                              [PUBLIC]   mixin.php
6
CLASS      C3                              [PUBLIC]   mixin.php
7
CLASS      C4                              [PUBLIC]   mixin.php
8
CLASS      C5                              [PUBLIC]   mixin.php
9
CLASS      Mixin                           [PUBLIC]   mixin.php
10
CLASS      MixinParent                     [PUBLIC]   mixin.php
11
------------------------------------
12
KEYWORD    array                                      null
13
KEYWORD    bool                                       null
14
KEYWORD    boolean                                    null
15
KEYWORD    callable                                   null
16
KEYWORD    callback                                   null
17
KEYWORD    double                                     null
18
KEYWORD    false                                      null
19
KEYWORD    float                                      null
20
KEYWORD    int                                        null
21
KEYWORD    integer                                    null
22
KEYWORD    iterable                                   null
23
KEYWORD    mixed                                      null
24
KEYWORD    null                                       null
25
KEYWORD    object                                     null
26
KEYWORD    resource                                   null
27
KEYWORD    self                                       null
28
KEYWORD    string                                     null
29
KEYWORD    true                                       null
30
KEYWORD    void                                       null
(-)a/php.editor/test/unit/data/testfiles/completion/lib/mixin/mixin.php.testMixinWithStaticAccess.completion (+19 lines)
Line 0 Link Here
1
Code completion result for source line:
2
Mixin::|publicStaticMethodC1(); // CC
3
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
4
METHOD     publicStaticMethodC1()          [STATIC]   C1
5
METHOD     publicStaticMethodC2()          [STATIC]   C2
6
METHOD     publicStaticMethodC3()          [STATIC]   C3
7
METHOD     publicStaticMethodC4()          [STATIC]   C4
8
METHOD     publicStaticMethodC5()          [STATIC]   C5
9
VARIABLE   ? $publicStaticFieldC1          [STATIC]   C1
10
VARIABLE   ? $publicStaticFieldC2          [STATIC]   C2
11
VARIABLE   ? $publicStaticFieldC3          [STATIC]   C3
12
VARIABLE   ? $publicStaticFieldC4          [STATIC]   C4
13
VARIABLE   ? $publicStaticFieldC5          [STATIC]   C5
14
CONSTANT   PUBLIC_CONST_C1 "PUBLIC_CONST_  [PUBLIC]   C1
15
CONSTANT   PUBLIC_CONST_C2 "PUBLIC_CONST_  [PUBLIC]   C2
16
CONSTANT   PUBLIC_CONST_C3 "PUBLIC_CONST_  [PUBLIC]   C3
17
CONSTANT   PUBLIC_CONST_C4 "PUBLIC_CONST_  [PUBLIC]   C4
18
CONSTANT   PUBLIC_CONST_C5 "PUBLIC_CONST_  [PUBLIC]   C5
19
CONSTANT   class \Mixin                    [PUBLIC]   Magic Constant
(-)a/php.editor/test/unit/data/testfiles/gotodeclaration/testMixin/testMixin.php (+30 lines)
Line 0 Link Here
1
<?php
2
3
namespace Mixin\A;
4
5
/**
6
 * @mixin MixinA2
7
 */
8
class MixinA1
9
{
10
}
11
12
class MixinA2
13
{
14
}
15
16
namespace Mixin\B;
17
18
/**
19
 * @mixin \Mixin\A\MixinA1
20
 */
21
class MixinB1
22
{
23
}
24
25
/**
26
 * @mixin \Mixin\A\MixinA2|MixinB1
27
 */
28
class MixinB2
29
{
30
}
(-)a/php.editor/test/unit/data/testfiles/index/testClassConstantVisibility/testClassConstantVisibility.php.indexed (-1 / +1 lines)
Lines 8-14 Link Here
8
8
9
Document 1
9
Document 1
10
Searchable Keys:
10
Searchable Keys:
11
  clz : classconstantvisibility;ClassConstantVisibility;13;;;;1;;0;<TESTURL>/testClassConstantVisibility.php;
11
  clz : classconstantvisibility;ClassConstantVisibility;13;;;;1;;0;<TESTURL>/testClassConstantVisibility.php;;
12
  clz.const : implicit_public_const;IMPLICIT_PUBLIC_CONST;50;0;0;<TESTURL>/testClassConstantVisibility.php;32;
12
  clz.const : implicit_public_const;IMPLICIT_PUBLIC_CONST;50;0;0;<TESTURL>/testClassConstantVisibility.php;32;
13
  clz.const : private_bar;PRIVATE_BAR;225;?;0;<TESTURL>/testClassConstantVisibility.php;2;
13
  clz.const : private_bar;PRIVATE_BAR;225;?;0;<TESTURL>/testClassConstantVisibility.php;2;
14
  clz.const : private_const;PRIVATE_CONST;130;2;0;<TESTURL>/testClassConstantVisibility.php;2;
14
  clz.const : private_const;PRIVATE_CONST;130;2;0;<TESTURL>/testClassConstantVisibility.php;2;
(-)a/php.editor/test/unit/data/testfiles/index/testGetClasses/testGetClasses.php.indexed (-3 / +3 lines)
Lines 8-14 Link Here
8
8
9
Document 1
9
Document 1
10
Searchable Keys:
10
Searchable Keys:
11
  clz : aaa;AAA;12;;;IAAA|\IAAA;1;;0;<TESTURL>/testGetClasses.php;
11
  clz : aaa;AAA;12;;;IAAA|\IAAA;1;;0;<TESTURL>/testGetClasses.php;;
12
  superiface : iaaa;IAAA;
12
  superiface : iaaa;IAAA;
13
  top : aaa
13
  top : aaa
14
14
Lines 17-23 Link Here
17
17
18
Document 2
18
Document 2
19
Searchable Keys:
19
Searchable Keys:
20
  clz : bbb;BBB;40;AAA|\AAA;;IBBB|\IBBB;1;;0;<TESTURL>/testGetClasses.php;
20
  clz : bbb;BBB;40;AAA|\AAA;;IBBB|\IBBB;1;;0;<TESTURL>/testGetClasses.php;;
21
  superclz : aaa;AAA;
21
  superclz : aaa;AAA;
22
  superiface : ibbb;IBBB;
22
  superiface : ibbb;IBBB;
23
  top : bbb
23
  top : bbb
Lines 27-33 Link Here
27
27
28
Document 3
28
Document 3
29
Searchable Keys:
29
Searchable Keys:
30
  clz : ccc;CCC;80;BBB|\BBB;;ICCC|\ICCC;1;;0;<TESTURL>/testGetClasses.php;
30
  clz : ccc;CCC;80;BBB|\BBB;;ICCC|\ICCC;1;;0;<TESTURL>/testGetClasses.php;;
31
  superclz : bbb;BBB;
31
  superclz : bbb;BBB;
32
  superiface : iccc;ICCC;
32
  superiface : iccc;ICCC;
33
  top : ccc
33
  top : ccc
(-)a/php.editor/test/unit/data/testfiles/index/testGetClassesWithNsInterfaces/testGetClassesWithNsInterfaces.php.indexed (-1 / +1 lines)
Lines 2-8 Link Here
2
2
3
Document 0
3
Document 0
4
Searchable Keys:
4
Searchable Keys:
5
  clz : nonsclassname;NoNsClassName;132;;No\Ns;NsInterfaceName|\NsFoo\NsBar\NsInterfaceName;1;;0;<TESTURL>/testGetClassesWithNsInterfaces.php;
5
  clz : nonsclassname;NoNsClassName;132;;No\Ns;NsInterfaceName|\NsFoo\NsBar\NsInterfaceName;1;;0;<TESTURL>/testGetClassesWithNsInterfaces.php;;
6
  superiface : nsinterfacename;NsInterfaceName;NsFoo\NsBar
6
  superiface : nsinterfacename;NsInterfaceName;NsFoo\NsBar
7
  top : nonsclassname
7
  top : nonsclassname
8
8
(-)a/php.editor/test/unit/data/testfiles/index/testGetFunctions/testGetFunctions.php.indexed (-1 / +1 lines)
Lines 14-20 Link Here
14
14
15
Document 1
15
Document 1
16
Searchable Keys:
16
Searchable Keys:
17
  clz : parameterclass;ParameterClass;14;;;;1;;0;<TESTURL>/testGetFunctions.php;
17
  clz : parameterclass;ParameterClass;14;;;;1;;0;<TESTURL>/testGetFunctions.php;;
18
  top : parameterclass
18
  top : parameterclass
19
19
20
Not Searchable Keys:
20
Not Searchable Keys:
(-)a/php.editor/test/unit/data/testfiles/index/testGetMethods/testGetMethods.php.indexed (-1 / +1 lines)
Lines 8-14 Link Here
8
8
9
Document 1
9
Document 1
10
Searchable Keys:
10
Searchable Keys:
11
  clz : testmethoddeclaration;testMethodDeclaration;12;;;;1;;0;<TESTURL>/testGetMethods.php;
11
  clz : testmethoddeclaration;testMethodDeclaration;12;;;;1;;0;<TESTURL>/testGetMethods.php;;
12
  method : testmethoddeclaration;testMethodDeclaration;56;;;1;0;<TESTURL>/testGetMethods.php;
12
  method : testmethoddeclaration;testMethodDeclaration;56;;;1;0;<TESTURL>/testGetMethods.php;
13
  top : testmethoddeclaration
13
  top : testmethoddeclaration
14
14
(-)a/php.editor/test/unit/data/testfiles/index/testIssue240824/testIssue240824.php.indexed (-1 / +1 lines)
Lines 8-14 Link Here
8
8
9
Document 1
9
Document 1
10
Searchable Keys:
10
Searchable Keys:
11
  clz : myconfig;MyConfig;13;;;;1;;0;<TESTURL>/testIssue240824.php;
11
  clz : myconfig;MyConfig;13;;;;1;;0;<TESTURL>/testIssue240824.php;;
12
  method : functionname;functionName;109;$param::0::1:0:0;;1;0;<TESTURL>/testIssue240824.php;
12
  method : functionname;functionName;109;$param::0::1:0:0;;1;0;<TESTURL>/testIssue240824.php;
13
  top : myconfig
13
  top : myconfig
14
14
(-)a/php.editor/test/unit/data/testfiles/index/testMixin/testMixin.php (+34 lines)
Line 0 Link Here
1
<?php
2
namespace A;
3
4
/**
5
 * @mixin B\C3|C2
6
 */
7
class C1
8
{
9
}
10
11
class C2
12
{
13
}
14
15
namespace A\B;
16
class C3
17
{
18
}
19
20
namespace Mixin;
21
22
/**
23
 * @mixin \A\B\C3
24
 */
25
class MixinParent
26
{
27
}
28
29
/**
30
 * @mixin \A\C1
31
 */
32
class Mixin extends MixinParent
33
{
34
}
(-)a/php.editor/test/unit/data/testfiles/index/testMixin/testMixin.php.indexed (+73 lines)
Line 0 Link Here
1
2
3
Document 0
4
Searchable Keys:
5
  clz : c1;C1;52;;A;;1;;0;<TESTURL>/testMixin.php;\A\B\C3,\A\C2;
6
  top : c1
7
8
Not Searchable Keys:
9
10
11
Document 1
12
Searchable Keys:
13
  clz : c2;C2;66;;A;;1;;0;<TESTURL>/testMixin.php;;
14
  top : c2
15
16
Not Searchable Keys:
17
18
19
Document 2
20
Searchable Keys:
21
  clz : c3;C3;95;;A\B;;1;;0;<TESTURL>/testMixin.php;;
22
  top : c3
23
24
Not Searchable Keys:
25
26
27
Document 3
28
Searchable Keys:
29
  clz : mixin;Mixin;200;MixinParent|\Mixin\MixinParent;Mixin;;1;;0;<TESTURL>/testMixin.php;\A\C1;
30
  superclz : mixinparent;MixinParent;Mixin
31
  top : mixin
32
33
Not Searchable Keys:
34
35
36
Document 4
37
Searchable Keys:
38
  clz : mixinparent;MixinParent;153;;Mixin;;1;;0;<TESTURL>/testMixin.php;\A\B\C3;
39
  top : mixinparent
40
41
Not Searchable Keys:
42
43
44
Document 5
45
Searchable Keys:
46
  identifier_used : a;
47
  identifier_used : a;
48
  identifier_used : b;
49
  identifier_used : c1;
50
  identifier_used : c1;
51
  identifier_used : c2;
52
  identifier_used : c2;
53
  identifier_used : c3;
54
  identifier_used : c3;
55
  identifier_used : c3;
56
  identifier_used : mixin;
57
  identifier_used : mixin;
58
  identifier_used : mixinparent;
59
  identifier_used : mixinparent;
60
61
Not Searchable Keys:
62
63
64
Document 6
65
Searchable Keys:
66
  ns : a;A;;0;<TESTURL>/testMixin.php;
67
  ns : b;B;A;0;<TESTURL>/testMixin.php;
68
  ns : mixin;Mixin;;0;<TESTURL>/testMixin.php;
69
  top : a
70
  top : a\b
71
  top : mixin
72
73
Not Searchable Keys:
(-)a/php.editor/test/unit/data/testfiles/index/testNullableTypesForMethods/testNullableTypesForMethods.php.indexed (-1 / +1 lines)
Lines 8-14 Link Here
8
8
9
Document 1
9
Document 1
10
Searchable Keys:
10
Searchable Keys:
11
  clz : nullabletypes;NullableTypes;12;;;;1;;0;<TESTURL>/testNullableTypesForMethods.php;
11
  clz : nullabletypes;NullableTypes;12;;;;1;;0;<TESTURL>/testNullableTypesForMethods.php;;
12
  method : parametertype;parameterType;49;$param:?string:1::1:0:0;;1;0;<TESTURL>/testNullableTypesForMethods.php;
12
  method : parametertype;parameterType;49;$param:?string:1::1:0:0;;1;0;<TESTURL>/testNullableTypesForMethods.php;
13
  method : parametertypestatic;parameterTypeStatic;115;$param:?string:1::1:0:0;;9;0;<TESTURL>/testNullableTypesForMethods.php;
13
  method : parametertypestatic;parameterTypeStatic;115;$param:?string:1::1:0:0;;9;0;<TESTURL>/testNullableTypesForMethods.php;
14
  method : returntype;returnType;180;$num:int:1::1:0:0;?\Foo;1;0;<TESTURL>/testNullableTypesForMethods.php;
14
  method : returntype;returnType;180;$num:int:1::1:0:0;?\Foo;1;0;<TESTURL>/testNullableTypesForMethods.php;
(-)a/php.editor/test/unit/data/testfiles/markoccurences/testMixin/testMixin.php (+30 lines)
Line 0 Link Here
1
<?php
2
3
namespace Mixin\A;
4
5
/**
6
 * @mixin MixinA2
7
 */
8
class MixinA1
9
{
10
}
11
12
class MixinA2
13
{
14
}
15
16
namespace Mixin\B;
17
18
/**
19
 * @mixin \Mixin\A\MixinA1
20
 */
21
class MixinB1
22
{
23
}
24
25
/**
26
 * @mixin \Mixin\A\MixinA2|MixinB1
27
 */
28
class MixinB2
29
{
30
}
(-)a/php.editor/test/unit/data/testfiles/testMixin.php.testMixin_01.occurrences (+2 lines)
Line 0 Link Here
1
class |>MARK_OCCURRENCES:MixinA^1<|
2
 * @mixin \Mixin\A\|>MARK_OCCURRENCES:MixinA1<|
(-)a/php.editor/test/unit/data/testfiles/testMixin.php.testMixin_02.occurrences (+2 lines)
Line 0 Link Here
1
class |>MARK_OCCURRENCES:MixinA1<|
2
 * @mixin \Mixin\A\|>MARK_OCCURRENCES:Mixi^nA1<|
(-)a/php.editor/test/unit/data/testfiles/testMixin.php.testMixin_03.occurrences (+3 lines)
Line 0 Link Here
1
 * @mixin |>MARK_OCCURRENCES:MixinA2<|
2
class |>MARK_OCCURRENCES:MixinA^2<|
3
 * @mixin \Mixin\A\|>MARK_OCCURRENCES:MixinA2<||MixinB1
(-)a/php.editor/test/unit/data/testfiles/testMixin.php.testMixin_04.occurrences (+3 lines)
Line 0 Link Here
1
 * @mixin |>MARK_OCCURRENCES:MixinA2<|
2
class |>MARK_OCCURRENCES:MixinA2<|
3
 * @mixin \Mixin\A\|>MARK_OCCURRENCES:Mixin^A2<||MixinB1
(-)a/php.editor/test/unit/data/testfiles/testMixin.php.testMixin_05.occurrences (+3 lines)
Line 0 Link Here
1
 * @mixin ^|>MARK_OCCURRENCES:MixinA2<|
2
class |>MARK_OCCURRENCES:MixinA2<|
3
 * @mixin \Mixin\A\|>MARK_OCCURRENCES:MixinA2<||MixinB1
(-)a/php.editor/test/unit/data/testfiles/testMixin.php.testMixin_06.occurrences (+2 lines)
Line 0 Link Here
1
class |>MARK_OCCURRENCES:Mix^inB1<|
2
 * @mixin \Mixin\A\MixinA2||>MARK_OCCURRENCES:MixinB1<|
(-)a/php.editor/test/unit/data/testfiles/testMixin.php.testMixin_07.occurrences (+2 lines)
Line 0 Link Here
1
class |>MARK_OCCURRENCES:MixinB1<|
2
 * @mixin \Mixin\A\MixinA2||>MARK_OCCURRENCES:Mixin^B1<|
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionMixinTest.java (+89 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 */
40
package org.netbeans.modules.php.editor.completion;
41
42
import java.io.File;
43
import java.util.Collections;
44
import java.util.Map;
45
import org.netbeans.api.java.classpath.ClassPath;
46
import org.netbeans.modules.php.project.api.PhpSourcePath;
47
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
48
import org.openide.filesystems.FileObject;
49
import org.openide.filesystems.FileUtil;
50
51
52
public class PHPCodeCompletionMixinTest extends PHPCodeCompletionTestBase {
53
54
    public PHPCodeCompletionMixinTest(String testName) {
55
        super(testName);
56
    }
57
58
    @Override
59
    protected Map<String, ClassPath> createClassPathsForTest() {
60
        return Collections.singletonMap(
61
            PhpSourcePath.SOURCE_CP,
62
            ClassPathSupport.createClassPath(new FileObject[]{
63
                FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/mixin/"))
64
            })
65
        );
66
    }
67
68
    // #241740 for @mixin tag
69
    public void testMixinTagType() throws Exception {
70
        checkCompletion("testfiles/completion/lib/mixin/mixin.php", " * @mixin ^C3", false);
71
    }
72
73
    public void testMixin() throws Exception {
74
        checkCompletion("testfiles/completion/lib/mixin/mixin.php", "$mixin->^publicMethodC1(); // CC", false);
75
    }
76
77
    public void testMixinWithStaticAccess() throws Exception {
78
        checkCompletion("testfiles/completion/lib/mixin/mixin.php", "Mixin::^publicStaticMethodC1(); // CC", false);
79
    }
80
81
    public void testMixinEnclosing() throws Exception {
82
        checkCompletion("testfiles/completion/lib/mixin/mixin.php", "        $this->^protectedMethodC1(); // CC", false);
83
    }
84
85
    public void testMixinEnclosingWithStaticAccess() throws Exception {
86
        checkCompletion("testfiles/completion/lib/mixin/mixin.php", "        Mixin::^protectedStaticMethodC1(); // CC", false);
87
    }
88
89
}
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/csl/GotoDeclarationMixinTest.java (+65 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 */
40
package org.netbeans.modules.php.editor.csl;
41
42
43
public class GotoDeclarationMixinTest extends GotoDeclarationTestBase {
44
45
    public GotoDeclarationMixinTest(String testName) {
46
        super(testName);
47
    }
48
49
    public void testMixin_01() throws Exception {
50
        checkDeclaration(getTestPath(), " * @mixin \\Mixin\\A\\Mixin^A1", "class ^MixinA1");
51
    }
52
53
    public void testMixin_02() throws Exception {
54
        checkDeclaration(getTestPath(), " * @mixin Mi^xinA2", "class ^MixinA2");
55
    }
56
57
    public void testMixin_03() throws Exception {
58
        checkDeclaration(getTestPath(), " * @mixin \\Mixin\\A\\MixinA^2|MixinB1", "class ^MixinA2");
59
    }
60
61
    public void testMixin_04() throws Exception {
62
        checkDeclaration(getTestPath(), " * @mixin \\Mixin\\A\\MixinA2|Mi^xinB1", "class ^MixinB1");
63
    }
64
65
}
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImplMixinTest.java (+77 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 */
40
package org.netbeans.modules.php.editor.csl;
41
42
43
public class OccurrencesFinderImplMixinTest extends OccurrencesFinderImplTestBase {
44
45
    public OccurrencesFinderImplMixinTest(String testName) {
46
        super(testName);
47
    }
48
49
    public void testMixin_01() throws Exception {
50
        checkOccurrences(getTestPath(), "class MixinA^1", true);
51
    }
52
53
    public void testMixin_02() throws Exception {
54
        checkOccurrences(getTestPath(), " * @mixin \\Mixin\\A\\Mixi^nA1", true);
55
    }
56
57
    public void testMixin_03() throws Exception {
58
        checkOccurrences(getTestPath(), "class MixinA^2", true);
59
    }
60
61
    public void testMixin_04() throws Exception {
62
        checkOccurrences(getTestPath(), " * @mixin \\Mixin\\A\\Mixin^A2|MixinB1", true);
63
    }
64
65
    public void testMixin_05() throws Exception {
66
        checkOccurrences(getTestPath(), " * @mixin ^MixinA2", true);
67
    }
68
69
    public void testMixin_06() throws Exception {
70
        checkOccurrences(getTestPath(), "class Mix^inB1", true);
71
    }
72
73
    public void testMixin_07() throws Exception {
74
        checkOccurrences(getTestPath(), " * @mixin \\Mixin\\A\\MixinA2|Mixin^B1", true);
75
    }
76
77
}
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/index/PHPIndexTest.java (+5 lines)
Lines 598-603 Link Here
598
        checkIndexer(getTestPath());
598
        checkIndexer(getTestPath());
599
    }
599
    }
600
600
601
    // #241740
602
    public void testMixin() throws Exception {
603
        checkIndexer(getTestPath());
604
    }
605
601
    @Override
606
    @Override
602
    protected FileObject[] createSourceClassPathsForTest() {
607
    protected FileObject[] createSourceClassPathsForTest() {
603
        final File folder = new File(getDataDir(), getTestFolderPath());
608
        final File folder = new File(getDataDir(), getTestFolderPath());

Return to bug 241740