aboutsummaryrefslogtreecommitdiff
path: root/java/com/google/turbine/binder/bytecode/BytecodeBinder.java
AgeCommit message (Collapse)Author
2022-02-01Automatic code cleanup.Kurt Alfred Kluever
PiperOrigin-RevId: 425631296
2021-07-21Annotate bytecode packages for nullnessLiam Miller-Cushon
PiperOrigin-RevId: 386122520
2021-07-20Report diagnostics for type conversionsLiam Miller-Cushon
When modeling primitive widening conversions, report diagnostics for invalid conversions instead of crashing. This rearranges the implementation to use switches on the primitive type kinds and casts instead of double-dispatch. The new approach makes it easier to access the position information needed to report a diagnostic, and also makes it more explicit which constants implement a particular conversion. PiperOrigin-RevId: 385854947
2021-01-19Add private constructors for classes that aren't intended to be instantiatedLiam Miller-Cushon
PiperOrigin-RevId: 352623709
2019-08-07Ignore another fake annotation in ct.symcushon
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=261369014
2019-07-31Skip fake 'profile' annotations on bootclasspathcushon
ct.sym contains a fake annotation jdk/Profile+Annotation without a corresponding class file. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=260819989
2019-06-27Clean up class reading of deficient numeric and boolean constantscushon
Deficient numeric types (char, byte, short) and booleans are all encoded as integers in the class file. Currently the class reader saves an int for all of those types, and we coerce to the appropriate type during binding by 'target typing'. However this logic is unnecessary for annotations, since element values have a local type tag in the class file. This changes class reading of annotations to immediately convert to the appropriate type, and saves the legacy 'target typing' to only apply to fields. We could handle fields during class reading too, but we defer handling descriptors/signatures to binding for performance reasons. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=254034125
2019-06-15Fix lintcushon
MOE_MIGRATED_REVID=251930479
2019-06-15Improve toString representationscushon
MOE_MIGRATED_REVID=251782540
2019-06-15Rename turbine's AnnotationValuecushon
to avoid a clash with the javax.lang.model.element class. MOE_MIGRATED_REVID=251530996
2019-01-28Miscellaneous cleanupscushon
MOE_MIGRATED_REVID=225619145
2018-10-23Use AutoValue for Type module objectscushon
in order to get equals and hashCode implementations. MOE_MIGRATED_REVID=218399705
2018-10-22Fix class literal-valued annotation defaultscushon
The type of a class literal isn't necessarily a class, as in `void.class`. MOE_MIGRATED_REVID=218197987
2018-10-17Fill in more of classes bound from bytecodecushon
The additional information is read in lazily, so it's inexpensive if we don't end up needing it. MOE_MIGRATED_REVID=217633111
2018-10-17Remove an unused 'throws' clausecushon
MOE_MIGRATED_REVID=217165296
2018-01-22Initial end-to-end support for module-infoscushon
MOE_MIGRATED_REVID=182836497
2016-10-31Disambiguate type annotations on fields, parameters, and methodscushon
Given a declaration like `private @A int x;` or `@A private int x;`, there are three possibilities: * `@A` is a declaration annotation on the field * `@A` is a `TYPE_USE` annotation on the type * `@A` sets `TYPE_USE` _and_ `FIELD` targets, and appears in the bytecode as both a declaration annotation and as a type annotation This can't be determined syntactically -- note that the presence of other modifiers before or after the annotation has no bearing on whether the annotation targets the type or the declaration. So, we wait until constant binding is done, read the `@Target` meta-annotation for each ambiguous annotation, and move it to the appropriate location. MOE_MIGRATED_REVID=137749757
2016-10-28Initial type annotation supportcushon
Handle binding of type annotations, evaluation of type annotation arguments, and lowering to bytecode for all type annotations kinds that can appears in headers. Currently type annotations are identified syntactically, we need to read @Target to deal with ambiguous declarations on fields and method return types (e.g. `@A int x;` could be `TYPE_USE` or `FIELD` or both). MOE_MIGRATED_REVID=137566512
2016-10-24Fix type canonicalization of recursive types, and wildcardscushon
Instantiate types recursively; previously [T/e]A<T> worked but [T/e]A<B<T>> didn't. Also handle instantiating arrays with parametric element types, which can't appear as top-level types during canonicalization but can appear as type arguments (e.g. [T/e]A<T[]> -> A<e[]>). The array instantiation case is interesting because it allows the creation of arrays with wildcard element types. The JVMS signature grammar [1] doesn't actually allow that, but both javac and ecj can be coerced into emitting it: class A<X> { class I {} } class Test { class B<Y> extends A<Y[]> {} B<?>.I i; // LA<[*>.I; } To support this, restructure the type and signature models to make wildcards first-class types, instead of only allowing them as top-level type arguments. [1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.9.1 MOE_MIGRATED_REVID=137101539
2016-10-05Type canonicalizationcushon
Canonicalize qualified type names so qualifiers are always the declaring class of the qualified type. For example, given: ``` class A<T> { class Inner {} } class B extends A<String> {} ``` The type name `B.Inner` must be canonicalized as `A<String>.Inner` in bytecode. MOE_MIGRATED_REVID=135300804