summaryrefslogtreecommitdiff
path: root/java/com/google/devtools/build
AgeCommit message (Collapse)Author
2017-12-18Automatic formatting cleanup of Android *.java files.jingwen
RELNOTES: None. PiperOrigin-RevId: 179425421 GitOrigin-RevId: 094caa508fa74081d861e9e8f8eb50934811bf65 Change-Id: I9019cbd3802e7d74c61cc9bb8af9a7ff9bc05e2c
2017-12-18Eagerly close directory content stream again when looking for dumped lambdaskmb
RELNOTES: None. PiperOrigin-RevId: 179245378 GitOrigin-RevId: dd6f8298529f05372d9c0c31eabf19f69d38b22e Change-Id: Iaf61b5eec2bc3f050a3aada9532e8bb3d03d723f
2017-12-18reflect prefix in additional ClassReader methods for consistency with what ↵kmb
happens during visit() RELNOTES: None. PiperOrigin-RevId: 179115377 GitOrigin-RevId: 02f05cbbcaf2f6748525bc53469689b92a4be936 Change-Id: I9704b3dbf3ab6f9bdfcda0a1c864ee7668240f76
2017-12-14make desugar resilient to unrelated lambdas being dumped while it runskmb
RELNOTES: None. PiperOrigin-RevId: 178952440 GitOrigin-RevId: 817b535d92ee7fdb4740e2a99505ab10d4b54a0d Change-Id: I1cffc3b930289b86c097414b5aba6a697e4d4e74
2017-12-14Correct stack map frame computation. When visiting CHOP Frame (discarding n ↵cnsun
local local variables), the current implementation deletes n local slots, which is wrong when the local variable to delete is of type category 2. This CL deletes local variables instead of local slots. Another change is using the Label objects to identify uninitialized values, instead of the offsets of labels, because the offsets of labels might not be computed. RELNOTES:n/a. PiperOrigin-RevId: 178762969 GitOrigin-RevId: 770b1779dfd4e673e1523bc7e6f1772d4f4dfc04 Change-Id: Ib1ae1a813a51649d5d9522bdf393f48e56432b66
2017-12-06Improve exception message to output more information.cnsun
RELNOTES:None. PiperOrigin-RevId: 177875613 GitOrigin-RevId: ddd5ac16aeffa6c4693c348f73e7365240b1abc5 Change-Id: Id8e000ab3d3ef7b35cfa008e5a84b130e0e79e57
2017-12-06Remove static import of inner class InferredType's fieldsccross
A few of the InferredType's fields were being static imported, but not all of them, and the use of the statically imported fields was inconsistent. Statically importing the inner class causes strange errors when building desugar in the Android platform build with OpenJDK8, but not OpenJDK9: external/desugar/java/com/google/devtools/build/android/desugar/BytecodeTypeInference.java:1015: error: cannot find symbol @AutoValue ^ symbol: class AutoValue location: class BytecodeTypeInference 1 error Remove the static imports to make the build work and to make the usage consistent. RELNOTES:None. PiperOrigin-RevId: 177875501 GitOrigin-RevId: b0fb55ad19e4751b61cbbf79ba60748b6e594100 Change-Id: I0c467abeeaac31fad138c7e2a90535740e68e8e9
2017-11-29Automatic code cleanup.cushon
PiperOrigin-RevId: 177261837 GitOrigin-RevId: 85d69f2397d7b54fa8b8c69b7bc9ec6d36cb1d49 Change-Id: Iab3521ac7d7a5c1340ba85fa036686a622f1065e
2017-11-29Let to push lambda arguments not only with *LOAD instructions but with ↵Googler
SIPUSH and *CONST_*. RELNOTES: None PiperOrigin-RevId: 177149410 GitOrigin-RevId: af10f2a83bdda8406a8c0a012db6d38e19d022b0 Change-Id: Ica86f3606d70b1cd25e336eb2cce5e369138ba76
2017-11-29Specialize $closeResource(Throwable, AutoCloseable) so that desugared code ↵cnsun
does not depend on AutoCloseable, as it is not available before API 19. This CL includes the following: 1. A type inference algorithm based on ASM. It relies on the stack map frames to compute type information at the entry of basic blocks. 2. The type inference is used to infer the types of the resources to be closed. Then for each concrete resource type, we specialize the synthetic $closeResource method to $closeResource(Throwable, <concrete resource type>). RELNOTES: None PiperOrigin-RevId: 175731437 GitOrigin-RevId: e83f3b1fb010298cbe1e16e5f7f2f39bfb045cef Change-Id: I347f8e4058a191621fb21bf2e81d7cf8f39ce6aa
2017-11-29Fix EnclosingMethod attribute when moving interface methods to companion classkmb
RELNOTES: None. PiperOrigin-RevId: 175613518 GitOrigin-RevId: f581da7375d8548ffaac61ead74cdc3519eeb5b2 Change-Id: I2333812920923fa8050022b8f482e139c37f9027
2017-10-24Record dependencies when directly calling moved interface methods.kmb
RELNOTES: None. PiperOrigin-RevId: 173154512 GitOrigin-RevId: a01493b751fa1a31e1cef929b36ee030402909fa Change-Id: Id96eb89cbca159e7ce7f0e72ec3c3312a7ba4071
2017-10-24Remove the implicit requirement of core_library.ccalvarin
The semantics of implicit requirements will soon change to adding the requirements in-place in the command line. This particular implicit requirement was not necessary. RELNOTES: None. PiperOrigin-RevId: 171841036 GitOrigin-RevId: b95f41b7aa8a53bee1fe0d4dc8dc843ddc22d2f7 Change-Id: Id8fda8f69c2ad6be85b381be4bc0d06ece4d0ceb
2017-10-24Do not rewrite static interface method invocations from bootclasspathGoogler
RELNOTES: n/a PiperOrigin-RevId: 171344856 GitOrigin-RevId: 38da0c2e6e082964e32e8646439cdec7cd50808f Change-Id: Ice56501cd04133409dacde89318abac85b1828b9
2017-10-24add flags to desugar to emit metadata that can be used for double-checking ↵kmb
correctness of default and static interface desugaring. RELNOTES: none PiperOrigin-RevId: 170779637 GitOrigin-RevId: bdb12ceeb7c23d7d2293e8006d0aa7127a91b973 Change-Id: I6969cc42323b5299a90af9e8084658e9f654825f
2017-09-06fix for legacy jacoco instrumentation in interfaces behind flagkmb
RELNOTES: n/a PiperOrigin-RevId: 167619442 GitOrigin-RevId: 831f7e179f8760cb31fb884c85fca1ea8197bdf5 Change-Id: Icc02e2af284406f69caacb74644a9c048c32acd1
2017-09-06PiperOrigin-RevId: 167167400kmb
GitOrigin-RevId: b3277b071150115e23c5ded04e84ff9e02d9df7e Change-Id: I60c8e8953b207212ce02e57d4376f3e4bd873b98
2017-09-06Add a closeResource(Throwable throwable, Object resource) in the runtimecnsun
library. Javac9 generates a helper method $closeResource(Throwable, AutoCloseable) sometimes for try-with-resources. Now we rewrite the call to call our version to avoid the dependency on AutoCloseable. RELNOTES: None PiperOrigin-RevId: 167025276 GitOrigin-RevId: e51e9924aebb48931224ba6da807c924fba240ae Change-Id: Ic9c2bfc64ef7a0f6ad6aca4aa15ed90f7bdc3775
2017-08-25Adds compile action for aapt2: Aapt2ResourcePackagingActioncorysmith
Adds a ManifestContainer interface to centralize the types that provide manifests. Adds PackagedResources to represent a linked dexless resource apk RELNOTES: None PiperOrigin-RevId: 166193049 GitOrigin-RevId: e516a101bb615f064d6622a5d4add541617b8c1f Change-Id: I06692f1093d15ddd6f15dc4cf6ea44b0626776d7
2017-08-25Remove workaround. The ASM bug is fixed. And we use ClassRemapper now.cnsun
RELNOTES: None PiperOrigin-RevId: 165949162 GitOrigin-RevId: fedeb9d8e6a599d991a5f8efb5faf2e7c3e465a5 Change-Id: I9ff4af1a68345e621ef58689d0bc4ffad7ac5328
2017-08-25Switch android tools' use of options parser to a more concise form for the ↵ccalvarin
single options-base case. This is to prepare the options parser from making options parser creation exceptions a caught exception. Since all of these classes already have a single options class and used parseAndExitUponError, this allows us to keep behavior consistent between the malformed options-base errors and the incorrect user-input errors. All the other uses of the options parser in //src/tools already throw sufficiently broad exceptions to not need this. RELNOTES: None PiperOrigin-RevId: 165702786 GitOrigin-RevId: 74a8c3e529f0c3ec9ab02db684e9d0ec4f71bf64 Change-Id: I944ff475980a1bad39e3cce6d7ebf674a3806a09
2017-08-17Validate and Link libraries action for aapt2corysmith
RELNOTES: None PiperOrigin-RevId: 165012084 GitOrigin-RevId: e8dd11a99f5772c8bc57b27fb81af010ad9ffca6 Change-Id: I45944b51af4fcf5e7e9ff82ed6e7affa774323d4
2017-08-17Remove invalid check. It is possible that an interface initializer can setcnsun
fields in other classes. The original check assumes that this is not possible. This CL just deletes that check. RELNOTES: None PiperOrigin-RevId: 164622080 GitOrigin-RevId: ae93cdf5f2377f9903a3003396b499787e334165 Change-Id: Ib8310704c69aad7bb53a2b8bc537e24124883d8c
2017-08-08improve efficiency of no-op desugaringskmb
- skip lambda desugaring when it won't do anything - skip ASM class writing when no desugarings apply to an input class also minor improvements to prefix remapping RELNOTES: none PiperOrigin-RevId: 164492293 GitOrigin-RevId: 67b1736235dcf4d57dd9fb2c8900f83f5ec83f51 Change-Id: I682d75ec74d938cd26bab29c56ea92ba25a06c4f
2017-08-08Android BusyBox: deprecate --libraries flaglaszlocsomor
Deprecate the --libraries flag of the GENERATE_BINARY_R tool in favour of --library. The new flag is multi-value and uses "," as the pair-separator instead of ":". The value converter still supports ":"-separated pairs as well, but looks for "," first. Old format: --libraries=key1:value1,key2:value2,... New format: --library=key1,value1 --library=key2,value2 Motivation: - the ":"-separator prevents using absolute paths on Windows The old flag is still supported, but will be removed after 2018-02-28 (about 6 months from now). Also in this commit: - add a new method to CustomCommandLine.Builder to lazily construct the command line for the --library flag See https://github.com/bazelbuild/bazel/issues/3264 RELNOTES: none PiperOrigin-RevId: 164246506 GitOrigin-RevId: 025a7b0a33680c53d872d241fdb49f3ab578afd6 Change-Id: Ic070877f13ca525b5cbcb2e4bf0ca9dd28e70001
2017-08-08Tolerate missing interface markers in method calls from interface methods to ↵kmb
methods in that interface. RELNOTES: none PiperOrigin-RevId: 164041648 GitOrigin-RevId: 78105ee42f9caf62492b69a8455bb42f7acef407 Change-Id: Icdc64135c8dbd30f53b2c79525453928c56a1b26
2017-08-08Alter the order of class visitors, to make sure that Objects.requireNonNUllcnsun
and Long.compare are correctly handled. RELNOTES: None PiperOrigin-RevId: 164018569 GitOrigin-RevId: 2714195feae97333bca4ef0896c416f5f07b2f92 Change-Id: I8be49b9cfe7b9a6af765abddf320c1c959f4ed4e
2017-08-02Android BusyBox: remove dead codelaszlocsomor
Remove Converters.ExistingPathListConverter, it wasn't used anywhere. RELNOTES: none PiperOrigin-RevId: 163810436 GitOrigin-RevId: 8db4454dbe103343d522a05bdd9f083b4cc13ff8 Change-Id: I0b43fd9509766f2dde20645beae3c3246de2f3ae
2017-08-02Disable desugaring try-with-resources when --min_sdk_version is above 18.cnsun
RELNOTES: None PiperOrigin-RevId: 163376758 GitOrigin-RevId: d8235cf959ac1326836064aa9442256b69f7318a Change-Id: I227f3d614573a7125ae276999d198fb52a0b2aab
2017-07-27In UseBridge.class, check whether the owner of the method call instruction andcnsun
the owner of the method reference have assignable relation. If yes, use the bridge method. This CL addresses the integration problem between Desugar and the lambda factory of JDK 9. The change in JDK 9 is here,http://hg.openjdk.java.net/jdk9/dev/jdk/rev/a3b3c7b6464d. RELNOTES: None PiperOrigin-RevId: 162965244 GitOrigin-RevId: 849213b66c3fe3740c765c2635259d1912125b43 Change-Id: Ibd9bf12029da6abfca9d4409fd1055b66d325818
2017-07-20Automated rollback of commit 01ddfb7bf418b371859de62f4eab2f41ea9a4a4a.laszlocsomor
This is a partial rollback. I restored the old flags (with PathListConverter), added the new ones, added deprecation warnings and annotations, and added code to concat the values of new and old. Existing released versions of Bazel should keep working with the new code until 2018-01-31, i.e. for the next ~6 months. After that I'll remove the old flags and the PathListConverter. *** Reason for rollback *** Fixed broken integration with release Blaze. *** Original change description *** Automated rollback of commit 5752463ece84ebb4fb074888cba57412ab8d86b3. *** Reason for rollback *** Broke too many targets. *** RELNOTES: none PiperOrigin-RevId: 162587548 GitOrigin-RevId: e1d3b87302cb11a4a1bad72b22cbe4b998296314 Change-Id: I0e030a491c0841d7f056076f9e49d2f8667985e0
2017-07-20Make the @Option annotation depend on the java version of the tagging enums.ccalvarin
The option filters proto dependency can be removed from the OptionsParser. This is in response to option parser users that want to avoid the bazel-internal proto file in their dependencies. RELNOTES: None. PiperOrigin-RevId: 162249778 GitOrigin-RevId: c82a19714dac1210654640ac1f5ca4d96df716a8 Change-Id: If5368c1d0c8ec90d2f07489c742aef53e13ce046
2017-07-20Internal changeGoogler
PiperOrigin-RevId: 162194755 GitOrigin-RevId: 01ddfb7bf418b371859de62f4eab2f41ea9a4a4a Change-Id: I7e6ff39bf895f4888a4caaf17b55c43af5eb1e8a
2017-07-20AndroidBusyBox: deprecate path-list-type flagslaszlocsomor
This commit: - deprecates PathListConverter - removes ExistingPathListConverter because it was not used in production, only tests - deprecated List<Path> type flags that use PathListConverter - introduces new List<Path> type flags next to the deprecated ones that use @Options.allowMultiple and convert with PathConverter; the new and old lists are concatenated, yielding the flag value PathListConverter and all of its occurrences should be removed after 2018-01-31 (about 6 months from now, which is a safe enough timeframe for everyone to upgrade Bazel so it uses the new-style flags). Reason for deprecation is that colon-separated path lists don't work on Windows because paths have colons in them. Since the Android BusyBox is not intended to be executed by users but by Bazel only, there's no release notes necessary. See https://github.com/bazelbuild/bazel/issues/3264 RELNOTES: none PiperOrigin-RevId: 162193998 GitOrigin-RevId: 5752463ece84ebb4fb074888cba57412ab8d86b3 Change-Id: I10dd387d28c5462c27f63e12d3a3a87a202270ff
2017-07-20Fold OptionUsageRestrictions into OptionDocumentationCategory and ↵ccalvarin
OptionMetadataTags. These are similar, no need to have both fields. Removing the "DOCUMENTED" default, the absence of UNDOCUMENTED will be used instead. Since requiring a documentation category for undocumented options doesn't make sense, list that as one of the OptionDocumentationCategories, but list HIDDEN and INTERNAL as part of OptionMetadata. These options should list UNDOCUMENTED as their category. PiperOrigin-RevId: 161515674 GitOrigin-RevId: 456adb2267343a4e2e64f082e77169c18f9e6060 Change-Id: Ia7dcbd5d38d4caa2d6d60f25b5a1f0c23735ca22
2017-07-20Identify which methods are used in invokedynamic, and only desugar thesecnsun
methods. RELNOTES: None PiperOrigin-RevId: 160663025 GitOrigin-RevId: 24d8cc8efa1b86fa5dcffcc3b223759eb7b2817f Change-Id: Iea20025391fab131d2e93e2459e06ceea5b19a65
2017-06-30Flip the flag --rewrite_calls_to_long_compare to false by default. Nowcnsun
desugaring Long.compare(long, long) is only enabled if either --min_sdk_version < 19 or --rewrite_calls_to_long_compare is specified. RELNOTES: set --rewrite_calls_to_long_compare to false by default. PiperOrigin-RevId: 160578028 GitOrigin-RevId: 7fe99c2c4417184f28ea9f213ea6dc83091f6b21 Change-Id: I4cf294b236f29dd3b6acbe4ef8479c878a5c38f3
2017-06-30Add categories transition values to android options.ccalvarin
Automated formatting fixes standardize the @Option annotation. PiperOrigin-RevId: 160567787 GitOrigin-RevId: db8c437ea1858bc8b9e9b2ec6838ed3916d0ce4b Change-Id: I3af7fdf0121f9947c7831d4de2b4056497d93e57
2017-06-30When we access a field of an interface, if the field is of type long or double,cnsun
then we use pop2 to pop the value out of the stack. RELNOTES: None PiperOrigin-RevId: 160453904 GitOrigin-RevId: 1b9933a96e6cc4217e8d8c3e6fe0646a345c680e Change-Id: I5d6bb6f7ce7356f3038c63899d631ac8f10f97ca
2017-06-30Access interface constants to explicitly trigger the execution of interfacecnsun
initializers. The problem is that when we desugar default methods, the static intializer of interface will not be executed. The JVM spec says that if an interface has default methods, then when it is loaded, it will also be initialized. After we desugar such an interface, its default methods are removed, and when we load the interface, the <clinit> will not be executed. This CL checks whether an interface has default methods and fields. If yes (needs to be initialized when the interface is loaded), it injects field access code to access the interface fields in the <clinit> of the companion class. We also create a constant $$CONSTANT$$ in the companion class. Then for all the classes that implement the interface, we inject GETSTATIC in the class <clinit> to the $$CONSTANT$$ of the companion class of the interface. This indirection is to avoid the IllegalAccessError when the interface is package private. Note that accessing an arbitrary interface field does not guarantee the interface will be initialized. We need to access the field that is initialized in the interface static initializer. RELNOTES: None PiperOrigin-RevId: 160414671 GitOrigin-RevId: 8740ca6bd0f4156aaf663c482bc3e9c7ebb2c556 Change-Id: I221d094c82d5bffa9b0a1f2082192b3211e70ea9
2017-06-30Automated rollback of commit 317e0de2113f0361c9dbf98653ceda4efea3f3e2.Googler
*** Original change description *** Access interface constants to explicitly trigger the execution of interface initializers. The problem is that when we desugar default methods, the static intializer of interface will not be executed. The JVM spec says that if an interface has default methods, then when it is loaded, it will also be initialized. After we desugar such an interface, its default methods are removed, and when we load the interface, the <clinit> will not be executed. This CL checks whether an interface has default me... *** ROLLBACK_OF=159496992 NO_SQ=PURE_ROLLBACK RELNOTES: None PiperOrigin-RevId: 159545752 GitOrigin-RevId: 2d008e824e4c5c39f00f21cfa879eed61d5b500a Change-Id: I0bd3917d683f058c0ebe8ba5c3bf7b10feb55722
2017-06-30Access interface constants to explicitly trigger the execution of interfacecnsun
initializers. The problem is that when we desugar default methods, the static intializer of interface will not be executed. The JVM spec says that if an interface has default methods, then when it is loaded, it will also be initialized. After we desugar such an interface, its default methods are removed, and when we load the interface, the <clinit> will not be executed. This CL checks whether an interface has default methods and fields. If yes (needs to be initialized when the interface is loaded), it injects field access code to access the interface fields in the <clinit> of the companion class. We also create a constant $$CONSTANT$$ in the companion class. Then for all the classes that implement the interface, we inject GETSTATIC in the class <clinit> to the $$CONSTANT$$ of the companion class of the interface. This indirection is to avoid the IllegalAccessError when the interface is package private. Note that accessing an arbitrary interface field does not guarantee the interface will be initialized. We need to access the field that is initialized in the interface static initializer. RELNOTES: None PiperOrigin-RevId: 159496992 GitOrigin-RevId: 9c931b3dfe204e5c25d016876c6ccb3ea55e7998 Change-Id: I5533612554270f6f36c3197ca4a2f65e3edc28d2
2017-06-16Extract FieldInfo as a top-level class. In the following CL, I will use thiscnsun
class in DefaultMethodClassFixer to fix the bug b/38255926 RELNOTES: n/a PiperOrigin-RevId: 158561127 GitOrigin-RevId: 221c2b686ebaec4f80355f2966d7e4f6f859a0e1 Change-Id: I9ed9d36a83075a294928cfe8ca0a2cc2043b5ce3
2017-06-16Erase <clinit> of interfaces to prevent <clinit> from execution during desugar.cnsun
For all declared non-premitive fields, this CL sets each one to null. RELNOTES: n/na PiperOrigin-RevId: 158305638 GitOrigin-RevId: 24d3709cd57690f5458675dc68948502a5800189 Change-Id: I470a456262cb077fae6697d79cdf558f52a6d3f1
2017-06-16Move bridge methods for default methods down to the implementing classes.cnsun
RELNOTES: n/na PiperOrigin-RevId: 158162658 GitOrigin-RevId: 50b59cec885c0a66ff3a45c51402c2d786796610 Change-Id: Id7407c1135e774ec1823bc12e4aff0dd2c55e099
2017-06-16Improve the error message when Desugar fails to load a class from thecnsun
classpath. Now it prints the name of the class that is under desugaring. RELNOTES: n/a PiperOrigin-RevId: 157889131 GitOrigin-RevId: 461adba25f24d77c7b8edb898145902b51c5ef67 Change-Id: Ie7f746e522ba6b6c8a93c8a2c2562028a1879638
2017-06-16Enable desugaring try-with-resources by default.cnsun
RELNOTES: none PiperOrigin-RevId: 157490771 GitOrigin-RevId: a06205b7778a0e3c11fd0294ff7c5b43682ca45f Change-Id: Idbf5be5c244e90d9f98608edb5b8d8ba3a3687ec
2017-06-16For static interface method, when we move it to the companion class,cnsun
append a suffix to the method name, so as to avoid name clash in the companion class. RELNOTES: n/a PiperOrigin-RevId: 157021961 GitOrigin-RevId: 721ea3e46922df63205e0ba87e49a50449e2f78b Change-Id: I50c54acfe64e8471f70f53343bb09fbcc0ed9ed1
2017-06-16Make Desugar work for relative dumpDirectory paths.Googler
Before CL 155913466, Desugar was not working when dumpDirectory was a relative path because of an extra/incorrect resolve() that ended up duplicating such a relative path. CL 155913466 fixed this by converting Desugar's dumpDirectory to an absolute path. However, CL 156257767 introduced a check that Desugar's dumpDirectory must match the one in Java's InnerClassLambdaMetafactory, which broke the case of a relative path again. Therefore, this CL undoes the conversion to absolute path again (so that Desugar's path matches that in InnerClassLambdaMetafactory). Instead, to make relative paths work, it drops the unnecessary/incorrect call to resolve(). A regression test is left for a future CL (I don't have a dev environment set up that would allow me to easily write one). RELNOTES: None. PiperOrigin-RevId: 156852882 GitOrigin-RevId: 6bb44ec649fe91dd1a3e33e02edfb3caf6d4b7e8 Change-Id: I4b83516a8ee1e70d5cb3817dbceeec9f6d75759e
2017-06-16Make checking of lambda dump directory accept relative path.cnsun
Before, we use Path.equals(Object), which will fail if we use relative path in the system property. Now I use Files.isSameFile which will check two paths point to the same file system resource. In https://github.com/bazelbuild/bazel/commit/69e855c7b0f0f7899a69a882cba0abd304233c97, I introduce the check to test whether setting the system property for lambda meta factory succeeds. However, the check does not consider relative path, which will always fail. RELNOTES: n/a PiperOrigin-RevId: 156796457 GitOrigin-RevId: 2238b5df580d9a30cce7ad1fe25c1c84abdda268 Change-Id: Ic3d901455a772b95a487af61cbb7d8117f342a00