public void applyRule( final SNode jarArchive, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) { String approxName = BuildString_Behavior.call_getText_4380385936562005550( SLinkOperations.getTarget(jarArchive, "containerName", true), null); if (!(approxName.endsWith("}")) && !(approxName .toLowerCase() .endsWith( BehaviorReflection.invokeVirtual( String.class, jarArchive, "virtual_getExpectedExtension_6967233722066020217", new Object[] {})))) { { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportWarning( SLinkOperations.getTarget(jarArchive, "containerName", true), "should end with `" + BehaviorReflection.invokeVirtual( String.class, jarArchive, "virtual_getExpectedExtension_6967233722066020217", new Object[] {}) + "'", "r:2349e4dd-6518-4a4c-9022-c7887bed8b52(jetbrains.mps.build.typesystem)", "1979010778009333641", null, errorTarget); { BaseQuickFixProvider intentionProvider = new BaseQuickFixProvider( "jetbrains.mps.build.typesystem.fixContainerName_QuickFix", false); intentionProvider.putArgument( "newExtension", BehaviorReflection.invokeVirtual( String.class, jarArchive, "virtual_getExpectedExtension_6967233722066020217", new Object[] {})); _reporter_2309309498.addIntentionProvider(intentionProvider); } } } }
public void applyRule( final SNode enumerationDataTypeDeclaration, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) { final boolean deriveFromExternal = eq_t6q6ek_a0a0a1( SPropertyOperations.getString_def( enumerationDataTypeDeclaration, MetaAdapterFactory.getProperty( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc26875dfbL, 0x116d5fed0c2L, "memberIdentifierPolicy"), "derive_from_presentation"), "derive_from_presentation"); final boolean deriveFromInternal = eq_t6q6ek_a0a1a1( SPropertyOperations.getString_def( enumerationDataTypeDeclaration, MetaAdapterFactory.getProperty( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc26875dfbL, 0x116d5fed0c2L, "memberIdentifierPolicy"), "derive_from_presentation"), "derive_from_internal_value"); // Suggest using internal values, if they are present in all members if (deriveFromExternal && ListSequence.fromList( SLinkOperations.getChildren( enumerationDataTypeDeclaration, MetaAdapterFactory.getContainmentLink( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc26875dfbL, 0xfc32151efeL, "member"))) .all( new IWhereFilter<SNode>() { public boolean accept(SNode it) { return SPropertyOperations.getString( it, MetaAdapterFactory.getProperty( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc321331b2L, 0xfc5ee06663L, "internalValue")) != null; } })) { { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportWarning( enumerationDataTypeDeclaration, "Member identifiers could be derived from internal values, since they are specified for all enumeration members", "r:00000000-0000-4000-0000-011c8959028f(jetbrains.mps.lang.structure.typesystem)", "1447401809585273479", null, errorTarget); { BaseQuickFixProvider intentionProvider = new BaseQuickFixProvider( "jetbrains.mps.lang.structure.typesystem.EnableDeriveFromInternalValues_QuickFix", false); _reporter_2309309498.addIntentionProvider(intentionProvider); } } } ListSequence.fromList( SLinkOperations.getChildren( enumerationDataTypeDeclaration, MetaAdapterFactory.getContainmentLink( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc26875dfbL, 0xfc32151efeL, "member"))) .visitAll( new IVisitor<SNode>() { public void visit(final SNode member) { // Warn about duplication in presentation if (!(deriveFromExternal) && ListSequence.fromList(SNodeOperations.getAllSiblings(member, false)) .where( new IWhereFilter<SNode>() { public boolean accept(SNode it) { return eq_t6q6ek_a0a0a0a0a0a0b0a0a0a0g0b( SPropertyOperations.getString( SNodeOperations.cast( it, MetaAdapterFactory.getConcept( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc321331b2L, "jetbrains.mps.lang.structure.structure.EnumerationMemberDeclaration")), MetaAdapterFactory.getProperty( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc321331b2L, 0xfc5ee06664L, "externalValue")), SPropertyOperations.getString( member, MetaAdapterFactory.getProperty( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc321331b2L, 0xfc5ee06664L, "externalValue"))); } }) .isNotEmpty()) { { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportWarning( member, "Duplicate value of a presentation value", "r:00000000-0000-4000-0000-011c8959028f(jetbrains.mps.lang.structure.typesystem)", "1447401809584866838", null, errorTarget); } } // Report duplicate values if (!(deriveFromInternal) && SPropertyOperations.getString( member, MetaAdapterFactory.getProperty( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc321331b2L, 0xfc5ee06663L, "internalValue")) != null && ListSequence.fromList(SNodeOperations.getAllSiblings(member, false)) .where( new IWhereFilter<SNode>() { public boolean accept(SNode it) { return eq_t6q6ek_a0a0a0a0a0a0e0a0a0a0g0b( SPropertyOperations.getString( SNodeOperations.cast( it, MetaAdapterFactory.getConcept( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc321331b2L, "jetbrains.mps.lang.structure.structure.EnumerationMemberDeclaration")), MetaAdapterFactory.getProperty( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc321331b2L, 0xfc5ee06663L, "internalValue")), SPropertyOperations.getString( member, MetaAdapterFactory.getProperty( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc321331b2L, 0xfc5ee06663L, "internalValue"))); } }) .isNotEmpty()) { { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportTypeError( member, "Duplicate value of an internal value", "r:00000000-0000-4000-0000-011c8959028f(jetbrains.mps.lang.structure.typesystem)", "1447401809584872588", null, errorTarget); } } // Report duplicate derived identifiers, be it presentation, internal value or java // identifiers final String memberValidId = EnumerationMemberDeclaration_BehaviorDescriptor.getConstantName_idi2Z$rBf .invoke(member); if (memberValidId == null) { { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportTypeError( member, "A derived identifier is null", "r:00000000-0000-4000-0000-011c8959028f(jetbrains.mps.lang.structure.typesystem)", "1447401809585113262", null, errorTarget); } } else { if (ListSequence.fromList(SNodeOperations.getAllSiblings(member, false)) .where( new IWhereFilter<SNode>() { public boolean accept(SNode it) { return eq_t6q6ek_a0a0a0a0a0a0a0i0a0a0a0g0b( EnumerationMemberDeclaration_BehaviorDescriptor .getConstantName_idi2Z$rBf.invoke( SNodeOperations.cast( it, MetaAdapterFactory.getConcept( 0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xfc321331b2L, "jetbrains.mps.lang.structure.structure.EnumerationMemberDeclaration"))), memberValidId); } }) .isNotEmpty()) { String msg = (deriveFromExternal ? "presentation value" : (deriveFromInternal ? "internal value" : "java identifier")); { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportTypeError( member, "Cannot derive unique member identifier from the " + msg + ". Duplicate derived value of an identifier - " + memberValidId + ". You may consider using a different strategy for 'member identifier'", "r:00000000-0000-4000-0000-011c8959028f(jetbrains.mps.lang.structure.typesystem)", "1447401809583290065", null, errorTarget); } } } } }); }
public void applyRule( final SNode classifier, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) { if (SNodeOperations.isInstanceOf( classifier, MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x1107e0cb103L, "jetbrains.mps.baseLanguage.structure.AnonymousClass")) || SNodeOperations.isInstanceOf( classifier, MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc367070a5L, "jetbrains.mps.baseLanguage.structure.EnumClass"))) { return; } if (SNodeOperations.isInstanceOf( SLinkOperations.getTarget( classifier, MetaAdapterFactory.getContainmentLink( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x112670d273fL, 0x112670d886aL, "visibility")), MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10af9586f0cL, "jetbrains.mps.baseLanguage.structure.PrivateVisibility"))) { return; } SModule module = classifier.getModel().getModule(); GlobalModuleDependenciesManager depManager = new GlobalModuleDependenciesManager(module); Collection<SModule> deps = depManager.getModules(GlobalModuleDependenciesManager.Deptype.COMPILE); Collection<SModule> depsReexport = depManager.getOnlyReexportModules(); for (SNode extendedClassifierType : Classifier__BehaviorDescriptor.getExtendedClassifierTypes_id1UeCwxlWKny.invoke( classifier)) { SNode extendedClassifier = SLinkOperations.getTarget( extendedClassifierType, MetaAdapterFactory.getReferenceLink( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier")); if (extendedClassifier == SNodeOperations.getNode( "6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)", "~Object")) { continue; } SModule classifierModule = extendedClassifier.getModel().getModule(); assert classifierModule != null; if (deps.contains(classifierModule) && !(depsReexport.contains(classifierModule))) { { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportWarning( classifier, "Usages of this classifier outside of '" + module.getModuleName() + "' module requires setting 'Export' flag for the dependency on '" + classifierModule.getModuleName() + "' module", "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)", "9721774220123915", null, errorTarget); { BaseQuickFixProvider intentionProvider = new BaseQuickFixProvider( "jetbrains.mps.baseLanguage.typesystem.PutReexportForExtendedClassifier_QuickFix", false); intentionProvider.putArgument("module", ((AbstractModule) module)); intentionProvider.putArgument("moduleToImport", classifierModule); _reporter_2309309498.addIntentionProvider(intentionProvider); } } } } }
public void applyRule( final SNode notExpression, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) { SNode currentExpression = SLinkOperations.getTarget( notExpression, MetaAdapterFactory.getContainmentLink( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbcf6bd10dL, 0xfbcf6c30a4L, "expression")); while (SNodeOperations.isInstanceOf( currentExpression, MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfb4ed32b7fL, "jetbrains.mps.baseLanguage.structure.ParenthesizedExpression"))) { currentExpression = SLinkOperations.getTarget( SNodeOperations.cast( currentExpression, MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfb4ed32b7fL, "jetbrains.mps.baseLanguage.structure.ParenthesizedExpression")), MetaAdapterFactory.getContainmentLink( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfb4ed32b7fL, 0xfb4ed32b80L, "expression")); } if (SNodeOperations.isInstanceOf( currentExpression, MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, "jetbrains.mps.baseLanguage.structure.BooleanConstant"))) { { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportWarning( notExpression, "The logical expression can be simplified", "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)", "3832376534031039831", null, errorTarget); { BaseQuickFixProvider intentionProvider = new BaseQuickFixProvider( "jetbrains.mps.baseLanguage.typesystem.SimplifyNotExpression_QuickFix", false); intentionProvider.putArgument( "nestedConstant", SNodeOperations.cast( currentExpression, MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, "jetbrains.mps.baseLanguage.structure.BooleanConstant"))); _reporter_2309309498.addIntentionProvider(intentionProvider); } } } }
public void applyRule( final SNode conceptDeclaration, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) { OldCommentMigraionCreator creator = new OldCommentMigraionCreator(); if (SConceptOperations.isExactly( SNodeOperations.asSConcept(SNodeOperations.asSConcept(conceptDeclaration)), MetaAdapterFactory.getInterfaceConcept( 0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x39384475a5756fb0L, "jetbrains.mps.lang.core.structure.IOldCommentContainer")) || SConceptOperations.isExactly( SNodeOperations.asSConcept(SNodeOperations.asSConcept(conceptDeclaration)), MetaAdapterFactory.getInterfaceConcept( 0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x9b3ed4f3a4d01ecL, "jetbrains.mps.lang.core.structure.IOldCommentAnnotation"))) { return; } if (ListSequence.fromList( AbstractConceptDeclaration__BehaviorDescriptor.getImmediateSuperconcepts_idhMuxyK2 .invoke(conceptDeclaration)) .contains( SNodeOperations.asNode( MetaAdapterFactory.getInterfaceConcept( 0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x39384475a5756fb0L, "jetbrains.mps.lang.core.structure.IOldCommentContainer"))) && creator.canCreateMigration(conceptDeclaration)) { { MessageTarget errorTarget = new NodeMessageTarget(); errorTarget = new PropertyMessageTarget("name"); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportWarning( conceptDeclaration, "Old comment container should be migrated", "r:cec599e3-51d2-48a7-af31-989e3cbd593c(jetbrains.mps.lang.core.typesystem)", "699163291709407479", null, errorTarget); { BaseQuickFixProvider intentionProvider = new BaseQuickFixProvider( "jetbrains.mps.lang.core.typesystem.CreateIntentionForOldCommentContainer_QuickFix", false); _reporter_2309309498.addIntentionProvider(intentionProvider); } } } if (ListSequence.fromList( AbstractConceptDeclaration__BehaviorDescriptor.getImmediateSuperconcepts_idhMuxyK2 .invoke(conceptDeclaration)) .contains( SNodeOperations.asNode( MetaAdapterFactory.getInterfaceConcept( 0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x9b3ed4f3a4d01ecL, "jetbrains.mps.lang.core.structure.IOldCommentAnnotation"))) && creator.canCreateMigration(conceptDeclaration)) { { MessageTarget errorTarget = new NodeMessageTarget(); errorTarget = new PropertyMessageTarget("name"); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportWarning( conceptDeclaration, "Old comment annotation should be migrated", "r:cec599e3-51d2-48a7-af31-989e3cbd593c(jetbrains.mps.lang.core.typesystem)", "699163291709408708", null, errorTarget); { BaseQuickFixProvider intentionProvider = new BaseQuickFixProvider( "jetbrains.mps.lang.core.typesystem.CreateIntentionForOldCommentAnnotation_QuickFix", false); _reporter_2309309498.addIntentionProvider(intentionProvider); } } } }