File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
examples/simple/src/main/java
java2ts-plugin/src/main/java/dev/harrel/java2ts Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 11public class Example {
2- public String [] hello ;
2+ public String [] hello2 ;
33}
Original file line number Diff line number Diff line change 88import org .gradle .api .tasks .SourceSet ;
99import org .gradle .api .tasks .SourceSetContainer ;
1010
11+ import java .util .Optional ;
1112import java .util .Set ;
1213
1314public class JavaToTsPlugin implements Plugin <Project > {
@@ -42,9 +43,9 @@ public void apply(Project project) {
4243
4344 private Provider <SourceSet > getDefaultSourceSet (Project project ) {
4445 return project .getProviders ().provider (() ->
45- project .getExtensions ()
46- . getByType ( SourceSetContainer . class )
47- . findByName ( " main" ));
46+ Optional . ofNullable ( project .getExtensions (). findByType ( SourceSetContainer . class ) )
47+ . map ( s -> s . findByName ( "main" ) )
48+ . orElseThrow (() -> new IllegalArgumentException ( "Source set was not provided and there was no source set named ' main'" ) ));
4849 }
4950
5051 private Provider <RegularFile > getDefaultOutput (Project project ) {
You can’t perform that action at this time.
0 commit comments