History log of /system/tools/aidl/type_java.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5d9bc936e45b5ffe487b1807b4a028dc3dc4df9f 01-Feb-2016 Christopher Wiley <wiley@google.com> Support @utf8InCpp List<String>

Bug: 26729450
Change-Id: I2ac61aadef4c3ff0527fe68b3a104f72821dd2c4
Test: unit, integration tests pass
/system/tools/aidl/type_java.cpp
9f40372e71c5e2fdf840eeabb5531f12665e9a91 28-Jan-2016 Christopher Wiley <wiley@google.com> Remap String to alternate types when @utf8 or @utf8InCpp

Now, it is no longer sufficient to identify an AIDL type by its
package and class name, since the list of annotations is also
needed to uniquely identify the type.

Express this by mapping "@utf8InCpp String" to aidl-internal.Utf8InCppString
and then re-using existing mechanism to ask for a language specific
type given the canonical AIDL type string.
- Adding another type variant and corresponding pointer (i.e. the way
nullable and array work) would cause that type hierarchy to expand
the number of ways we have to connect the types.
- Passing a set of annotations through the type namespace adds
syntactic cruft we can avoid by mapping annotations to special
packages.
- Adding special getters for "utf8 string type" expands the contract
between the generic type namespace and the language specific type
name spaces. Currently the only mechanism to get a type is to
provide its canonical AIDL type.

Support @utf8InCpp in Java generation for the sake of unittests passing.
This type is identical to a normal string type (UTF16 on the wire).

Bug: 26729450
Test: unittests continue to pass

Change-Id: Ib017ce40ea01a50b50a157c0ef8b483a892b99b9
/system/tools/aidl/type_java.cpp
d21bfee0d45a5eb8ffb09eaae3c6d81f3dd292f7 30-Jan-2016 Christopher Wiley <wiley@google.com> Fully separate AIDL and Java type namespaces

For android::aidl::ValidatableType, rename:
- QualifiedName() -> CanonicalName()
- Name() -> ShortName()

For android::aidl::java::Type, add a new JavaType() method.
Use that method exclusively when generating Java.

Bug: 26875320
Test: unit and integration tests pass

Change-Id: Ib1d09f4f84d3270634e611f0911f60a2e685cefc
/system/tools/aidl/type_java.cpp
12e894a3b69f045f104a9026765ecbc60ec5967e 29-Jan-2016 Christopher Wiley <wiley@google.com> Remove last using directives from global header scope

Bug: None
Test: Compiles, unittests pass

Change-Id: I66dee2504b28049ecb74526a08345e999d57db8d
/system/tools/aidl/type_java.cpp
9ab06237fd51e625286a62fdd4fe5f948e698131 27-Jan-2016 Christopher Wiley <wiley@google.com> Make string matching the last resort way to look up types

That is, Find(const AidlType&) will call FindByName(const std::string&)
rather than the other way around. Later we'll use annotations in the
AidlType to pick one of several different type name strings.

Bug: 26729450
Test: unittests continue to pass

Change-Id: I10fcb88eabda30b88d5457ecfc8931755a0aa872
/system/tools/aidl/type_java.cpp
57dbe24bcb8f4509a876e8445c78d9504d7e616a 04-Dec-2015 Casey Dahlin <sadmac@google.com> Add support for @nullable annotation

Using this annotation will now cause C++ types to be wrapped in
unique_ptr, and by extension be capable of handling null values.

Support extends to all arrays, Strings, Lists, and Parcelables.

Change-Id: I148a3666279c2badcba097b8925e55f8fcecb9c2
Test: Unit tests pass
Bug: 25969194
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/type_java.cpp
a2f77c40fb6287895e2030055c0104eac0a1f73a 02-Dec-2015 Casey Dahlin <sadmac@google.com> Make array types their own type object

We now offer much simpler functionality from type objects. In addition,
we attach type objects to the appropriate AST nodes, so generators can
just read and trust the model.

Test: Unit tests pass
Bug: 25939691
Change-Id: Id274a933c7bd4f1e5d6daf2b89a64b3553a37069
/system/tools/aidl/type_java.cpp
0a62067f35e957493bc37c4b42dfdcfc16353831 04-Dec-2015 Elliott Hughes <enh@google.com> Track base/ -> android-base/ change.

Change-Id: I02b64b42c17d248c5fb2c4de4b0778a441e018e3
/system/tools/aidl/type_java.cpp
a4ba4b6868977b26b471860c038c7bbda4470946 03-Nov-2015 Casey Dahlin <sadmac@google.com> Add support for file descriptors

Change-Id: I172cbb02bbb034ca5d41b1958674b22bb8a7f93e
Test: Expanded unit tests
Bug: 25242023
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/type_java.cpp
c1f39b4ea30e7313eeb7f3d3fd5ec66ba00f2bb5 24-Nov-2015 Casey Dahlin <sadmac@google.com> Refactor top-level AST nodes v2

The previous version of this patch was tainted by parts of another
change to remove a memory leak, and ended up trying to treat a bare
pointer like a unique_ptr in a few places. This combines both changes in
to one.

Previous patch was b696437d842d59c0cc26411fa3d71cb91897c572:

We now return an AidlDocument from parsing. This type is non-polymorphic
and contains either a vector of parcelables or an interface. This gets
rid of all of our reinterpret_cast calls and the public item_type field.

Change-Id: I77fbb1d8448343bd02484d896289a514d636df25
Test: Unit tests pass
Bug: none
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/type_java.cpp
eedb29f028af472b90fa528c84d0d89100346e5c 24-Nov-2015 Bart Sears <bsears@google.com> Revert "Refactor top-level AST nodes"

This reverts commit b696437d842d59c0cc26411fa3d71cb91897c572.

Change-Id: Id5c716536299cfad4d13c5891d9be8b1fa2aceae
/system/tools/aidl/type_java.cpp
b696437d842d59c0cc26411fa3d71cb91897c572 17-Nov-2015 Casey Dahlin <sadmac@google.com> Refactor top-level AST nodes

We now return an AidlDocument from parsing. This type is non-polymorphic
and contains either a vector of parcelables or an interface. This gets
rid of all of our reinterpret_cast calls and the public item_type field.

Change-Id: Ia15ace677f79a153f8ebfad84ed43b08f4a3685f
Test: unit and integration tests pass
Bug: 25479378
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/type_java.cpp
5679952c38925a54b75b087068887002e57f3174 31-Oct-2015 Christopher Wiley <wiley@google.com> Don't call virtual methods in TypeNamespace constructors

While probably safe in this particular context because of this specific
class structure, it is bad practice to call virtual methods in constructors.

Bug: None
Test: unittests continue to pass

Change-Id: I3c9a435efd89a2c2bd7ce576aed585b8ab766bda
/system/tools/aidl/type_java.cpp
09af469476ea6d187b52f22113d3b168a887100c 30-Oct-2015 Christopher Wiley <wiley@google.com> Consolidate type checking logic

Move logic used to check types used in AIDL into a common superclass
of the language specific type namespaces. Add a templated
LanguageTypeNamespace class to allow language specific type reasoning
while sharing an implementation.

Move functionality important to the the AIDL type checking into
ValidatableType and out of the Java and C++ subclasses.

Removed GenericType from the Java type system because it messed around
with the canonical name for a type post construction, while adding
absolutely no value of its own.

Bug: 24470786
Test: unittests continue to pass, full build of android succeeds.

Change-Id: Ic03eb5d770c7f51abbde87c20a9b7287ce6a277e
/system/tools/aidl/type_java.cpp
cd8e89795c331e3e5c75e92d7c7804f389804e08 26-Oct-2015 Christopher Wiley <wiley@google.com> Consolidate container canonicalization logic

We need this same logic while piecing together C++ types because
we still have to reason about the type names used in AIDL.

Bug: 24470786
Test: unittests pass, integration tests pass

Change-Id: Ief2d531e1dace5e5e299f3aa246a870eb9c932c6
/system/tools/aidl/type_java.cpp
690bfbd363ffb6aa1cb64b94549d2c22db7bd6ba 24-Oct-2015 Christopher Wiley <wiley@google.com> Rely on the compiler to enforce abstract base classes

Bug: 25242025
Test: Compiles, unittests pass

Change-Id: If6f23721eab47925826c2193bf37bdcc5c030f76
/system/tools/aidl/type_java.cpp
685a8ed1840bb11b28e7a16cf43dc49f92f498b1 17-Oct-2015 Christopher Wiley <wiley@google.com> Remove dead Java AST code

It looks like the original authors at one point thought about importing
types rather than using canonical names. However, this code has no
callsite.

Bug: None
Test: unittests pass

Change-Id: I26c6bd741d8c97e56b4599b0c4bc3a86acb7374d
/system/tools/aidl/type_java.cpp
59401da7787cbc224785c0a03c30f6392445c1ec 10-Oct-2015 Casey Dahlin <sadmac@google.com> Put parcelable members behind getters

Bug: 24410295
Change-Id: I28b70254c8e1846eaeab8523da5975843e86e0de
Test: Full android build
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/type_java.cpp
fb7da2e62fe66b0a57ffbb0304f5884024a68f1c 09-Oct-2015 Casey Dahlin <sadmac@google.com> Put AidlInterface members behind methods

Change-Id: Ib367a9183e734a008acecf90c5f3f25e51e16b37
Test: Full android build
Bug: 24410295
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/type_java.cpp
1ae2bc56d20fe0e19262f2721abc338662fa6e30 08-Oct-2015 Casey Dahlin <sadmac@google.com> Convert document item structs to classes

This is the least-complete first run for any of these structs, but this
shift is going to be particularly gnarly, so we need to be
extra-incremental about it.

Change-Id: I7295add8b9a1291f229743f8c36d941569a16ab6
Test: unit tests
Bug: 24410295
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/type_java.cpp
db154a5f543ff697248df649a14f2ac4a70cbf0e 29-Sep-2015 Christopher Wiley <wiley@google.com> Move Java related code into a java namespace

This lets us use names like Type instead of CppType for generated
code specific to C++. C++ code will similarly go in its own namespace.

Bug: 24472672
Test: Compiles, unittests pass

Change-Id: I10fc8ce6436e297eb36c7b63e0c6d78a45bf2a19
/system/tools/aidl/type_java.cpp
fb4b22dfbe0f87aaad492dc8a25201179c235bae 26-Sep-2015 Christopher Wiley <wiley@google.com> Explicitly create container types

Now we explicitly give ourselves a change to create each
container type before attempting to resolve a type name
to an instance of Type. In the process we finally remove
all knowledge of specific types from aidl.cpp by moving
logic into the TypeNamespace itself.

Bug: 24303749
Test: Compiles, unittests, clean build of aosp_arm passes.

Change-Id: Ie5e1b29020618863dac9417e0a60730ddb0dfc02
/system/tools/aidl/type_java.cpp
4582ecb1e8799b062265915282edd567295d2ee6 25-Sep-2015 Christopher Wiley <wiley@google.com> Make creating container types more explicit

Calling TypeNamespace::Search() has the side effect of actually
creating an instance of a container type (e.g. List<Bar>) if
the conatiner type doesn't exist. Make this more explicit,
in preparation for just creating container types explicitly and
fixing these misleading semantics.

Bug: 24303749
Test: unittests, clean build of Android passes

Change-Id: Ic7f6e42167fda5d4d462570c8e1ec3a24fd153ec
/system/tools/aidl/type_java.cpp
60b02ae5398377dbd651b2ce375dfa603514d5ae 24-Sep-2015 Christopher Wiley <wiley@google.com> Remove *_TYPE global variables.

At long last, the type interface is entirely contained
within an instance of JavaTypeNamespace.

Bug: 24303749
Test: Compiles, unittests pass, clean build of Android passes

Change-Id: I0a7e993c0e9492158874831671100f2c42c3d008
/system/tools/aidl/type_java.cpp
8b2d3ee344b982b0ea387c08e596fd639e22309a 24-Sep-2015 Christopher Wiley <wiley@google.com> Remove NAMES global type namespace

We now pass around an instance of JavaTypeNamespace to
resolve types.

Add a const pointer to this namespace to java Type objects.
This enables a lot of cases where we need to refer to the
type namespace as we dynamically resolve types.

Prototype a method to remove INT_TYPE global constant by looking
up the appropriate type in an instance of JavaTypeNamespace.

Bug: 24303749
Test: Compiles, unittests pass

Change-Id: I3bb25ffb875e1e55f0548b6cd0e84e3e8bbf817e
/system/tools/aidl/type_java.cpp
84c1eacc7f09377d7724f0783187b0477fe7c2ba 23-Sep-2015 Christopher Wiley <wiley@google.com> Use TypeNamespace instances in aidl.cpp

Refactor much of the logic around types into an instance of
TypeNamespace. This class defines an interface to type reasoning
logic that aidl.cpp can use to register binder and parcelable types
it loads during parsing. Code generation can use a language specific
subclass of the type namespace to reason about types more specifically.

For now, leave NAMES and the global type constants intact. We'll
refactor those in a separate change if necessary.

Bug: 24303749
Test: Compiles, unittests pass

Change-Id: Ie56a89159c956c587a1ff3e45d38d1850b04a9f2
/system/tools/aidl/type_java.cpp
214c916028246ac6ede992877adfd8def175c8dd 24-Sep-2015 Christopher Wiley <wiley@google.com> Revert "Use TypeNamespace instances in aidl.cpp"

This fixes a build break while we investigate.

This reverts commit d03b54f61d1a0fb1a2791ee96d476180a5d38c85.

Change-Id: I200e7a6c84274e71ea661f8d952807e8266c5e54
/system/tools/aidl/type_java.cpp
d03b54f61d1a0fb1a2791ee96d476180a5d38c85 23-Sep-2015 Christopher Wiley <wiley@google.com> Use TypeNamespace instances in aidl.cpp

Refactor much of the logic around types into an instance of
TypeNamespace. This class defines an interface to type reasoning
logic that aidl.cpp can use to register binder and parcelable types
it loads during parsing. Code generation can use a language specific
subclass of the type namespace to reason about types more specifically.

For now, leave NAMES and the global type constants intact. We'll
refactor those in a separate change if necessary.

Bug: 24303749
Test: Compiles, unittests pass

Change-Id: Ie961dcef4f10bc23932ce45c39a1b190d272ab72
/system/tools/aidl/type_java.cpp
8f6816ea1fb532cff9ce0ecc1449926553b4e1da 23-Sep-2015 Christopher Wiley <wiley@google.com> Don't allow non-const pointers to Type instances

This makes the namespace into a read only datastructure of types
with a few methods to load types during parsing.

Bug: 24303749
Test: compiles, unittests

Change-Id: I0873e520d771b348a1a8ec9515b6e7b9a8a29298
/system/tools/aidl/type_java.cpp
3637a4d41d9dd1669d92127212fb4822a315ab76 23-Sep-2015 Christopher Wiley <wiley@google.com> Make all possible Type methods const

While here, mark inherited virtual methods as override methods.

Bug: 24303749
Test: Compiles, unittests

Change-Id: Ia7114b53e243b8539a6c84e1b96bb68fee5281cd
/system/tools/aidl/type_java.cpp
775fa1f7db4626b85e5185149b054821fc605c2b 23-Sep-2015 Christopher Wiley <wiley@google.com> Rename Type.* to type_java.*

We'll soon have type_cpp variations on these files, and a more
generic type.h

Bug: 24303749
Test: Compiles, unittests

Change-Id: I64f45efa3553f1a46d2d16d6652eedd6b324b2e4
/system/tools/aidl/type_java.cpp