Skip to content

Commit

Permalink
https://github.com/manifold-systems/manifold/issues/551
Browse files Browse the repository at this point in the history
- some java.awt classes, such as Component, internally use classes that are somehow not accessible using manifold's normal reflection scheme. For instance, an inner class extends sun.java2d.pipe.hw.ExtendedBufferCapabilities. This class is not accessible despite using reflection to open sun.java2d.pipe.hw to all in the java.awt module. As a temporary measure code gen has changed to ignore classes like this since they tend not to be relevant in generated stub classes.
  • Loading branch information
rsmckinney committed Mar 12, 2024
1 parent 130708b commit 00be94a
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,21 @@ private SrcType makeNestedType( Type type )

private void addInnerClass( IModule module, SrcClass srcClass, Symbol sym, BasicJavacTask javacTask )
{
SrcClass innerClass = makeSrcClass( sym.getQualifiedName().toString(), srcClass, (Symbol.ClassSymbol)sym, null, javacTask, module, null, null, true );
srcClass.addInnerClass( innerClass );
try
{
SrcClass innerClass = makeSrcClass( sym.getQualifiedName().toString(), srcClass, (Symbol.ClassSymbol)sym, null, javacTask, module, null, null, true );
srcClass.addInnerClass( innerClass );
}
catch( NullPointerException npe )
{
//todo:
// This happens when an inner class extends a class that is not accessible from Manifold for unknown reasons. An
// extension class on java.awt.Component in jdk 21 demonstrates this. Most of the time the inner class can be
// ignored bc it is usually private and not referenced in declarations. Anyhow, the inaccessible class should be
// made accessible via reflection, one way or another. Make this work.
System.err.println( "Warning: Failed to generate inner class: " + sym.getQualifiedName() );
npe.printStackTrace( System.err );
}
}

private void addField( SrcClass srcClass, Symbol.VarSymbol sym )
Expand Down

0 comments on commit 00be94a

Please sign in to comment.