Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
be59fc26
Commit
be59fc26
authored
Jun 03, 2015
by
j4cbo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #101 from dropbox/AT/WIP/JavaNullability
Fixes to Java nullability annotations
parents
d47163a4
b4ec8091
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
22 deletions
+31
-22
example/generated-src/java/com/dropbox/textsort/SortItems.java
...le/generated-src/java/com/dropbox/textsort/SortItems.java
+2
-2
src/source/JavaGenerator.scala
src/source/JavaGenerator.scala
+4
-1
src/source/JavaMarshal.scala
src/source/JavaMarshal.scala
+6
-0
test-suite/generated-src/java/com/dropbox/djinni/test/CppException.java
...erated-src/java/com/dropbox/djinni/test/CppException.java
+1
-1
test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java
...nerated-src/java/com/dropbox/djinni/test/TestHelpers.java
+18
-18
No files found.
example/generated-src/java/com/dropbox/textsort/SortItems.java
View file @
be59fc26
...
...
@@ -10,8 +10,8 @@ import javax.annotation.Nonnull;
public
abstract
class
SortItems
{
public
abstract
void
sort
(
@Nonnull
SortOrder
order
,
@Nonnull
ItemList
items
);
@
Nonn
ull
public
static
native
SortItems
createWithListener
(
TextboxListener
listener
);
@
CheckForN
ull
public
static
native
SortItems
createWithListener
(
@CheckForNull
TextboxListener
listener
);
public
static
final
class
CppProxy
extends
SortItems
{
...
...
src/source/JavaGenerator.scala
View file @
be59fc26
...
...
@@ -156,7 +156,10 @@ class JavaGenerator(spec: Spec) extends Generator(spec) {
skipFirst
{
w
.
wl
}
writeDoc
(
w
,
m
.
doc
)
val
ret
=
marshal
.
returnType
(
m
.
ret
)
val
params
=
m
.
params
.
map
(
p
=>
marshal
.
paramType
(
p
.
ty
)
+
" "
+
idJava
.
local
(
p
.
ident
))
val
params
=
m
.
params
.
map
(
p
=>
{
val
nullityAnnotation
=
marshal
.
nullityAnnotation
(
p
.
ty
).
map
(
_
+
" "
).
getOrElse
(
""
)
nullityAnnotation
+
marshal
.
paramType
(
p
.
ty
)
+
" "
+
idJava
.
local
(
p
.
ident
)
})
marshal
.
nullityAnnotation
(
m
.
ret
).
foreach
(
w
.
wl
)
w
.
wl
(
"public static native "
+
ret
+
" "
+
idJava
.
method
(
m
.
ident
)
+
params
.
mkString
(
"("
,
", "
,
")"
)
+
";"
)
}
...
...
src/source/JavaMarshal.scala
View file @
be59fc26
...
...
@@ -44,6 +44,12 @@ class JavaMarshal(spec: Spec) extends Marshal(spec) {
ty
.
resolved
.
base
match
{
case
MOptional
=>
javaNullableAnnotation
case
p
:
MPrimitive
=>
None
case
m
:
MDef
=>
m
.
defType
match
{
case
DInterface
=>
javaNullableAnnotation
case
DEnum
=>
javaNonnullAnnotation
case
DRecord
=>
javaNonnullAnnotation
}
case
_
=>
javaNonnullAnnotation
}
}
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/CppException.java
View file @
be59fc26
...
...
@@ -10,7 +10,7 @@ import javax.annotation.Nonnull;
public
abstract
class
CppException
{
public
abstract
int
throwAnException
();
@
Nonn
ull
@
CheckForN
ull
public
static
native
CppException
get
();
public
static
final
class
CppProxy
extends
CppException
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java
View file @
be59fc26
...
...
@@ -12,62 +12,62 @@ public abstract class TestHelpers {
@Nonnull
public
static
native
SetRecord
getSetRecord
();
public
static
native
boolean
checkSetRecord
(
SetRecord
rec
);
public
static
native
boolean
checkSetRecord
(
@Nonnull
SetRecord
rec
);
@Nonnull
public
static
native
PrimitiveList
getPrimitiveList
();
public
static
native
boolean
checkPrimitiveList
(
PrimitiveList
pl
);
public
static
native
boolean
checkPrimitiveList
(
@Nonnull
PrimitiveList
pl
);
@Nonnull
public
static
native
NestedCollection
getNestedCollection
();
public
static
native
boolean
checkNestedCollection
(
NestedCollection
nc
);
public
static
native
boolean
checkNestedCollection
(
@Nonnull
NestedCollection
nc
);
@Nonnull
public
static
native
HashMap
<
String
,
Long
>
getMap
();
public
static
native
boolean
checkMap
(
HashMap
<
String
,
Long
>
m
);
public
static
native
boolean
checkMap
(
@Nonnull
HashMap
<
String
,
Long
>
m
);
@Nonnull
public
static
native
HashMap
<
String
,
Long
>
getEmptyMap
();
public
static
native
boolean
checkEmptyMap
(
HashMap
<
String
,
Long
>
m
);
public
static
native
boolean
checkEmptyMap
(
@Nonnull
HashMap
<
String
,
Long
>
m
);
@Nonnull
public
static
native
MapListRecord
getMapListRecord
();
public
static
native
boolean
checkMapListRecord
(
MapListRecord
m
);
public
static
native
boolean
checkMapListRecord
(
@Nonnull
MapListRecord
m
);
public
static
native
void
checkClientInterfaceAscii
(
ClientInterface
i
);
public
static
native
void
checkClientInterfaceAscii
(
@CheckForNull
ClientInterface
i
);
public
static
native
void
checkClientInterfaceNonascii
(
ClientInterface
i
);
public
static
native
void
checkClientInterfaceNonascii
(
@CheckForNull
ClientInterface
i
);
public
static
native
void
checkEnumMap
(
HashMap
<
Color
,
String
>
m
);
public
static
native
void
checkEnumMap
(
@Nonnull
HashMap
<
Color
,
String
>
m
);
public
static
native
void
checkEnum
(
Color
c
);
public
static
native
void
checkEnum
(
@Nonnull
Color
c
);
@
Nonn
ull
public
static
native
Token
tokenId
(
Token
t
);
@
CheckForN
ull
public
static
native
Token
tokenId
(
@CheckForNull
Token
t
);
@
Nonn
ull
@
CheckForN
ull
public
static
native
Token
createCppToken
();
public
static
native
void
checkCppToken
(
Token
t
);
public
static
native
void
checkCppToken
(
@CheckForNull
Token
t
);
public
static
native
long
cppTokenId
(
Token
t
);
public
static
native
long
cppTokenId
(
@CheckForNull
Token
t
);
public
static
native
void
checkTokenType
(
Token
t
,
String
type
);
public
static
native
void
checkTokenType
(
@CheckForNull
Token
t
,
@Nonnull
String
type
);
@CheckForNull
public
static
native
Integer
returnNone
();
/** Ensures that we generate integer translation code */
@Nonnull
public
static
native
AssortedPrimitives
assortedPrimitivesId
(
AssortedPrimitives
i
);
public
static
native
AssortedPrimitives
assortedPrimitivesId
(
@Nonnull
AssortedPrimitives
i
);
@Nonnull
public
static
native
byte
[]
idBinary
(
byte
[]
b
);
public
static
native
byte
[]
idBinary
(
@Nonnull
byte
[]
b
);
public
static
final
class
CppProxy
extends
TestHelpers
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment