Delete the ImmutableMap bindings for soy plugins
These are no longer used by the compiler and should not be used by soy customers.
Startblock:
[] is submitted
GITHUB_BREAKING_CHANGES=none
package com.google.template.soy.shared.internal;
-import com.google.common.collect.ImmutableMap;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.multibindings.Multibinder;
import com.google.template.soy.shared.restricted.ApiCallScopeBindingAnnotations.LocaleString;
import com.google.template.soy.shared.restricted.SoyFunction;
import com.google.template.soy.shared.restricted.SoyPrintDirective;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import javax.inject.Singleton;
/**
* Guice module for users that want to contribute plugins to Soy via Guice.
@@ -44,6 +39,8 @@ public final class SharedModule extends AbstractModule {
Multibinder.newSetBinder(binder(), SoyFunction.class);
Multibinder.newSetBinder(binder(), SoyPrintDirective.class);
+ // TODO(user): Once LocaleString is dead, eliminate this and construct it directly in
+ // SoyFileSet
bind(SoyScopedData.class).toInstance(new SoySimpleScope());
}
@@ -54,56 +51,6 @@ public final class SharedModule extends AbstractModule {
return data.getLocale();
}
- /**
- * Builds and provides the map of all installed SoyFunctions (name to function).
- *
- * @param soyFunctionsSet The installed set of SoyFunctions (from Guice Multibinder).
- */
- @Provides
- @Singleton
- ImmutableMap<String, ? extends SoyFunction> provideSoyFunctionsMap(
- Set<SoyFunction> soyFunctionsSet) {
- Map<String, SoyFunction> mapBuilder = new LinkedHashMap<>();
- for (SoyFunction function : soyFunctionsSet) {
- SoyFunction old = mapBuilder.put(function.getName(), function);
- if (old != null && !old.getClass().getName().equals(function.getClass().getName())) {
- throw new IllegalStateException(
- "Found two functions with the same name: '"
- + function.getName()
- + "' and different implementations: "
- + function
- + " vs "
- + old);
- }
- }
- return ImmutableMap.copyOf(mapBuilder);
- }
-
- /**
- * Builds and provides the map of all installed SoyPrintDirectives (name to directive).
- *
- * @param soyDirectivesSet The installed set of SoyPrintDirectives (from Guice Multibinder).
- */
- @Provides
- @Singleton
- ImmutableMap<String, ? extends SoyPrintDirective> provideSoyDirectivesMap(
- Set<SoyPrintDirective> soyDirectivesSet) {
- Map<String, SoyPrintDirective> mapBuilder = new LinkedHashMap<>();
- for (SoyPrintDirective directive : soyDirectivesSet) {
- SoyPrintDirective old = mapBuilder.put(directive.getName(), directive);
- if (old != null && !old.getClass().getName().equals(directive.getClass().getName())) {
- throw new IllegalStateException(
- "Found two print directives with the same name: '"
- + directive.getName()
- + "' and different implementations: "
- + directive
- + " vs "
- + old);
- }
- }
- return ImmutableMap.copyOf(mapBuilder);
- }
-
@Override
public boolean equals(Object other) {
return other != null && this.getClass().equals(other.getClass());
