Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refinements to the singleton logic. There was to many small inconsist…
…encies. Need Eugene to review
- Loading branch information
1 parent
e6f3470
commit a0bb3c2
Showing
6 changed files
with
199 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.immutables.fixture; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import org.immutables.value.Value; | ||
|
||
// Compilation tests for singletons/builders | ||
|
||
@Value.Immutable(singleton = true) | ||
interface Sing1 { | ||
List<Integer> list(); | ||
|
||
default void use() { | ||
ImmutableSing1.builder(); | ||
ImmutableSing1.of() | ||
.withList(Collections.emptyList()); | ||
} | ||
} | ||
|
||
@Value.Immutable(builder = false) | ||
interface Sing2 { | ||
@Value.Default | ||
default int a() { | ||
return 1; | ||
} | ||
|
||
default void use() { | ||
ImmutableSing2.of().withA(1); | ||
} | ||
} | ||
|
||
@Value.Immutable(builder = false) | ||
interface Sing3 { | ||
default void use() { | ||
ImmutableSing3.of(); | ||
} | ||
} | ||
|
||
@Value.Immutable(singleton = true) | ||
interface Sing4 { | ||
|
||
default void use() { | ||
ImmutableSing4.builder(); | ||
ImmutableSing4.of(); | ||
} | ||
} | ||
|
||
@Value.Immutable(builder = false, singleton = true) | ||
interface Sing5 { | ||
@Value.Parameter | ||
@Value.Default | ||
default int a() { | ||
return 1; | ||
} | ||
|
||
default void use() { | ||
ImmutableSing5.of(); | ||
ImmutableSing5.of(1); | ||
} | ||
} | ||
|
||
@Value.Immutable | ||
interface Sing6 { | ||
default void use() { | ||
ImmutableSing6.builder(); | ||
ImmutableSing6.of(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.