Rename useSkylarkSemantics to useStarlarkSemantics RELNOTES: None. PiperOrigin-RevId: 253027175
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/config/ConfigGlobalLibraryApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/config/ConfigGlobalLibraryApi.java index 3104a0f..4c3330c 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/config/ConfigGlobalLibraryApi.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/config/ConfigGlobalLibraryApi.java
@@ -123,7 +123,7 @@ + "an analysis test requires to be set in order to pass."), }, useLocation = true, - useSkylarkSemantics = true) + useStarlarkSemantics = true) public ConfigurationTransitionApi analysisTestTransition( SkylarkDict<String, String> changedSettings, Location location, StarlarkSemantics semantics) throws EvalException;
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java index d7355de..dc132b8 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java
@@ -374,7 +374,7 @@ allowedTypes = {@ParamType(type = JavaToolchainSkylarkApiProviderApi.class)}, doc = "A JavaToolchainInfo to used to find the ijar tool."), }, - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true) public FileApi runIjar( SkylarkActionFactoryT actions, @@ -424,7 +424,7 @@ allowedTypes = {@ParamType(type = JavaToolchainSkylarkApiProviderApi.class)}, doc = "A JavaToolchainInfo to used to find the stamp_jar tool."), }, - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true) public FileApi stampJar( SkylarkActionFactoryT actions, @@ -486,7 +486,7 @@ doc = "A JavaRuntimeInfo to be used for packing sources."), }, allowReturnNones = true, - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true) public FileApi packSources( SkylarkActionFactoryT actions,
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaSkylarkApiProviderApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaSkylarkApiProviderApi.java index 9fb4955..39725a8 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaSkylarkApiProviderApi.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaSkylarkApiProviderApi.java
@@ -42,7 +42,7 @@ @SkylarkCallable( name = "source_jars", doc = "Returns the Jars containing Java source files for the target.", - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true, structField = true) public NestedSet<FileT> getSourceJars(Location location, StarlarkSemantics semantics) @@ -51,7 +51,7 @@ @SkylarkCallable( name = "transitive_deps", doc = "Returns the transitive set of Jars required to build the target.", - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true, structField = true) public NestedSet<FileT> getTransitiveDeps(Location location, StarlarkSemantics semantics) @@ -60,7 +60,7 @@ @SkylarkCallable( name = "transitive_runtime_deps", doc = "Returns the transitive set of Jars required on the target's runtime classpath.", - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true, structField = true) public NestedSet<FileT> getTransitiveRuntimeDeps(Location location, StarlarkSemantics semantics) @@ -71,7 +71,7 @@ doc = "Returns the Jars containing Java source files for the target and all of its transitive " + "dependencies.", - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true, structField = true) public NestedSet<FileT> getTransitiveSourceJars(Location location, StarlarkSemantics semantics) @@ -80,7 +80,7 @@ @SkylarkCallable( name = "outputs", doc = "Returns information about outputs of this Java target.", - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true, structField = true) public JavaRuleOutputJarsProviderApi<?> getOutputJars( @@ -89,7 +89,7 @@ @SkylarkCallable( name = "transitive_exports", structField = true, - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true, doc = "Returns transitive set of labels that are being exported from this rule.") public NestedSet<Label> getTransitiveExports(Location location, StarlarkSemantics semantics) @@ -99,7 +99,7 @@ name = "annotation_processing", structField = true, allowReturnNones = true, - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true, doc = "Returns information about annotation processing for this Java target.") public JavaAnnotationProcessingApi<?> getGenJarsProvider( @@ -109,7 +109,7 @@ name = "compilation_info", structField = true, allowReturnNones = true, - useSkylarkSemantics = true, + useStarlarkSemantics = true, useLocation = true, doc = "Returns compilation information for this Java target.") public JavaCompilationInfoProviderApi<?> getCompilationInfoProvider(
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java b/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java index 70206a6..667aa4b 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkCallable.java
@@ -21,14 +21,14 @@ import java.lang.annotation.Target; /** - * Annotates a Java method that can be called from Skylark. + * Annotates a Java method that can be called from Starlark. * * <p>This annotation is only allowed to appear on methods of classes that are directly annotated * with {@link SkylarkModule} or {@link SkylarkGlobalLibrary}. Since subtypes can't add new - * Skylark-accessible methods unless they have their own {@code @SkylarkModule} annotation, this - * implies that you can always determine the complete set of Skylark entry points for a given {@link - * SkylarkValue} type by looking at the ancestor class or interface from which it inherits its - * {@code @SkylarkModule}. + * Starlark-accessible methods unless they have their own {@code @SkylarkModule} annotation, this + * implies that you can always determine the complete set of Starlark entry points for a given + * {@link StarlarkValue} type by looking at the ancestor class or interface from which it inherits + * its {@code @SkylarkModule}. * * <p>If a method is annotated with {@code @SkylarkCallable}, it is not allowed to have any * overloads or hide any static or default methods. Overriding is allowed, but the @@ -50,7 +50,7 @@ * where (extra positionals list) is a SkylarkList if extraPositionals is defined, (extra * kwargs) is a SkylarkDict if extraKeywords is defined, and Location, FuncallExpression, * Environment, and StarlarkSemantics are supplied by the interpreter if and only if - * useLocation, useAst, useEnvironment, and useSkylarkSemantics are specified, respectively. + * useLocation, useAst, useEnvironment, and useStarlarkSemantics are specified, respectively. * <li>The number of method parameters much match the number of annotation-declared parameters * plus the number of interpreter-supplied parameters. * </ul> @@ -59,20 +59,18 @@ @Retention(RetentionPolicy.RUNTIME) public @interface SkylarkCallable { - /** - * Name of the method, as exposed to Skylark. - */ + /** Name of the method, as exposed to Starlark. */ String name(); /** - * The documentation text in Skylark. It can contain HTML tags for special formatting. + * The documentation text in Starlark. It can contain HTML tags for special formatting. * * <p>It is allowed to be empty only if {@link #documented()} is false. */ String doc() default ""; /** - * If true, the function will appear in the Skylark documentation. Set this to false if the + * If true, the function will appear in the Starlark documentation. Set this to false if the * function is experimental or an overloading and doesn't need to be documented. */ boolean documented() default true; @@ -120,13 +118,13 @@ /** * If true, indicates that the class containing the annotated method has the ability to be called - * from skylark (as if it were a function) and that the annotated method should be invoked when + * from Starlark (as if it were a function) and that the annotated method should be invoked when * this occurs. * - * <p>A class may only have one method with selfCall set to true.</p> + * <p>A class may only have one method with selfCall set to true. * - * <p>A method with selfCall=true must not be a structField, and must have name specified - * (used for descriptive errors if, for example, there are missing arguments).</p> + * <p>A method with selfCall=true must not be a structField, and must have name specified (used + * for descriptive errors if, for example, there are missing arguments). */ boolean selfCall() default false; @@ -155,7 +153,7 @@ boolean useAst() default false; /** - * If true, the Skylark Environment will be passed as an argument of the annotated function. + * If true, the Starlark Environment will be passed as an argument of the annotated function. * (Thus, the annotated method signature must contain Environment as a parameter. See the * interface-level javadoc for details.) * @@ -164,11 +162,11 @@ boolean useEnvironment() default false; /** - * If true, the Skylark semantics will be passed as an argument of the annotated function. (Thus, + * If true, the Starlark semantics will be passed as an argument of the annotated function. (Thus, * the annotated method signature must contain StarlarkSemantics as a parameter. See the * interface-level javadoc for details.) */ - boolean useSkylarkSemantics() default false; + boolean useStarlarkSemantics() default false; /** * If true, StarlarkContext will be passed as an argument of the annotated function. (Thus, the
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkinterface/processor/SkylarkCallableProcessor.java b/src/main/java/com/google/devtools/build/lib/skylarkinterface/processor/SkylarkCallableProcessor.java index 344ba77..39a6632 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkinterface/processor/SkylarkCallableProcessor.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkinterface/processor/SkylarkCallableProcessor.java
@@ -439,16 +439,16 @@ } currentIndex++; } - if (annotation.useSkylarkSemantics()) { + if (annotation.useStarlarkSemantics()) { if (!STARLARK_SEMANTICS.equals(methodSignatureParams.get(currentIndex).asType().toString())) { throw new SkylarkCallableProcessorException( methodElement, String.format( - "Expected parameter index %d to be the %s type, matching useSkylarkSemantics, " + "Expected parameter index %d to be the %s type, matching useStarlarkSemantics, " + "but was %s", currentIndex, STARLARK_SEMANTICS, - methodSignatureParams.get(currentIndex).asType().toString())); + methodSignatureParams.get(currentIndex).asType())); } currentIndex++; } @@ -471,7 +471,7 @@ numExtraInterpreterParams += annotation.useLocation() ? 1 : 0; numExtraInterpreterParams += annotation.useAst() ? 1 : 0; numExtraInterpreterParams += annotation.useEnvironment() ? 1 : 0; - numExtraInterpreterParams += annotation.useSkylarkSemantics() ? 1 : 0; + numExtraInterpreterParams += annotation.useStarlarkSemantics() ? 1 : 0; numExtraInterpreterParams += annotation.useContext() ? 1 : 0; return numExtraInterpreterParams; }
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/MethodDescriptor.java b/src/main/java/com/google/devtools/build/lib/syntax/MethodDescriptor.java index 3ae488f..f906c90 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/MethodDescriptor.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/MethodDescriptor.java
@@ -46,7 +46,7 @@ private final boolean useLocation; private final boolean useAst; private final boolean useEnvironment; - private final boolean useSkylarkSemantics; + private final boolean useStarlarkSemantics; private final boolean useContext; private MethodDescriptor( @@ -64,7 +64,7 @@ boolean useLocation, boolean useAst, boolean useEnvironment, - boolean useSkylarkSemantics, + boolean useStarlarkSemantics, boolean useContext) { this.method = method; this.annotation = annotation; @@ -80,7 +80,7 @@ this.useLocation = useLocation; this.useAst = useAst; this.useEnvironment = useEnvironment; - this.useSkylarkSemantics = useSkylarkSemantics; + this.useStarlarkSemantics = useStarlarkSemantics; this.useContext = useContext; } @@ -112,7 +112,7 @@ annotation.useLocation(), annotation.useAst(), annotation.useEnvironment(), - annotation.useSkylarkSemantics(), + annotation.useStarlarkSemantics(), annotation.useContext()); } @@ -195,9 +195,9 @@ return useEnvironment; } - /** @see SkylarkCallable#useSkylarkSemantics() */ + /** @see SkylarkCallable#useStarlarkSemantics() */ boolean isUseSkylarkSemantics() { - return useSkylarkSemantics; + return useStarlarkSemantics; } /** See {@link SkylarkCallable#useContext()}. */
diff --git a/src/test/java/com/google/devtools/build/lib/skylarkinterface/processor/testsources/GoldenCase.java b/src/test/java/com/google/devtools/build/lib/skylarkinterface/processor/testsources/GoldenCase.java index 6f41aab..65c0761 100644 --- a/src/test/java/com/google/devtools/build/lib/skylarkinterface/processor/testsources/GoldenCase.java +++ b/src/test/java/com/google/devtools/build/lib/skylarkinterface/processor/testsources/GoldenCase.java
@@ -42,7 +42,7 @@ name = "struct_field_method_with_info", documented = false, structField = true, - useSkylarkSemantics = true) + useStarlarkSemantics = true) public String structFieldMethodWithInfo(StarlarkSemantics semantics) { return "foo"; } @@ -66,7 +66,7 @@ useAst = true, useLocation = true, useEnvironment = true, - useSkylarkSemantics = true) + useStarlarkSemantics = true) public Integer zeroArgMethod( Location location, FuncallExpression ast, @@ -116,7 +116,7 @@ useAst = true, useLocation = true, useEnvironment = true, - useSkylarkSemantics = true) + useStarlarkSemantics = true) public String threeArgMethodWithParams( String one, Integer two, @@ -165,7 +165,7 @@ useAst = true, useLocation = true, useEnvironment = true, - useSkylarkSemantics = true, + useStarlarkSemantics = true, useContext = true) public String twoArgMethodWithParamsAndInfoAndKwargs( String one, @@ -218,7 +218,7 @@ structField = true, useLocation = true, useEnvironment = true, - useSkylarkSemantics = true) + useStarlarkSemantics = true) public String structFieldMethodWithInfo( Location location, Environment environment, StarlarkSemantics starlarkSemantics) { return "dragon";
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java index bbcde18..43a17af 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
@@ -166,7 +166,7 @@ name = "struct_field_with_extra", documented = false, structField = true, - useSkylarkSemantics = true) + useStarlarkSemantics = true) public String structFieldWithExtra(StarlarkSemantics sem) { return "struct_field_with_extra(" + (sem != null) @@ -316,7 +316,7 @@ useLocation = true, useAst = true, useEnvironment = true, - useSkylarkSemantics = true, + useStarlarkSemantics = true, useContext = true) public String withExtraInterpreterParams( Location location, @@ -384,7 +384,7 @@ useAst = true, useLocation = true, useEnvironment = true, - useSkylarkSemantics = true) + useStarlarkSemantics = true) public String withParamsAndExtraInterpreterParams( Integer pos1, boolean pos2,