deprecated @Ambient annotation

@Ambient annotation was used to inline declarations. However they suffer
from the Java packages structure, which is less flexible than namespaces
in TypeScript. Since @Ambient are always defined in the package they
appear, they are not convenient when working out of the root package.
Plus, now that def.* packages are working well in version 2, the
@Ambient annotation is redundant with using def.* packages. So, it was
decided that all ambient declarations should be defined in def.*
packages, thus forcing the developers to cleanly separate the actual
implementation from the bridges to external libraries. We believe it is
good practice to do so in Java in order to have a better-structured
program.
This commit is contained in:
Renaud Pawlak 2017-05-06 09:44:53 +02:00
parent c6a468998e
commit 7cee074faa
2 changed files with 6 additions and 2 deletions

View File

@ -16,7 +16,6 @@
*/
package jsweet.lang;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@ -57,10 +56,12 @@ import def.js.String;
* <p>
* This solution is cleaner than using the {@link Object#$get(String)} function,
* which is not typed.
*
* @deprecated Please use a <code>def.*</code> package for declarations.
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD })
@Documented
public @interface Ambient {
}

View File

@ -57,7 +57,10 @@ import def.js.String;
* <p>
* This solution is cleaner than using the {@link Object#$get(String)} function,
* which is not typed.
*
* @deprecated Please use a <code>def.*</code> package for declarations.
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD })
@Documented