@@ -867,21 +867,25 @@ const formatFieldDeclaration = (
867867 sourceImports : string [ ] ,
868868 conflictingNames : Set < string > ,
869869) => {
870- const prefix =
871- member . kind === 'constant' || member . isStatic
872- ? inInterface
873- ? 'static '
874- : 'public static '
875- : inInterface
876- ? ''
877- : 'public ' ;
870+ const prefix = inInterface
871+ ? ''
872+ : member . kind === 'constant' || member . isStatic
873+ ? 'public static '
874+ : 'public ' ;
875+ const initializer = inInterface
876+ ? ` = ${ getGeneratedName (
877+ 'RemapStub' ,
878+ 'li.songe.remap.RemapStub' ,
879+ conflictingNames ,
880+ ) } .value()`
881+ : '' ;
878882 return `${ indent ( level ) } ${ prefix } ${ formatAnnotatedType (
879883 member . type ,
880884 member . fieldNullability ,
881885 member ,
882886 sourceImports ,
883887 conflictingNames ,
884- ) } ${ member . name } ;`;
888+ ) } ${ member . name } ${ initializer } ;`;
885889} ;
886890
887891const formatMemberDeclaration = (
@@ -1197,6 +1201,7 @@ const collectImports = (
11971201 packageName : string ,
11981202 aidlSource : boolean ,
11991203 aidlInterface : boolean ,
1204+ inInterface : boolean ,
12001205 actualClassPath : string [ ] ,
12011206 displayClassPath : string [ ] ,
12021207 baselineApiVersion : number | undefined ,
@@ -1214,6 +1219,14 @@ const collectImports = (
12141219 if ( hasRemappedClass ( actualClassPath , displayClassPath ) ) {
12151220 addImport ( imports , packageName , 'li.songe.remap.RemapType' ) ;
12161221 }
1222+ if (
1223+ inInterface &&
1224+ declarations . some (
1225+ ( { member } ) => member . kind === 'field' || member . kind === 'constant' ,
1226+ )
1227+ ) {
1228+ addImport ( imports , packageName , 'li.songe.remap.RemapStub' ) ;
1229+ }
12171230 if ( declarations . some ( ( declaration ) => declaration . remapMethodName ) ) {
12181231 addImport ( imports , packageName , 'li.songe.remap.RemapMethod' ) ;
12191232 }
@@ -1366,6 +1379,7 @@ const renderCode = (
13661379 packageName ,
13671380 ! ! result . source ?. path . endsWith ( '.aidl' ) ,
13681381 includeAidlStub ,
1382+ inInterface ,
13691383 actualClassPath ,
13701384 displayClassPath ,
13711385 baselineApiVersion ,
0 commit comments