Skip to content

Reflection only works with accessor public? #1408

@Erklaerbaer

Description

@Erklaerbaer

Hi,

I am implementing Pong but getting errors

Caused by: com.almasb.fxgl.core.reflect.ReflectionException: Cannot inject Physics() into physics Error: java.lang.IllegalAccessException: class com.almasb.fxgl.core.reflect.ReflectionUtils (in module com.almasb.fxgl.core) cannot access a member of class silke.learns.fxgl.pong.silkepong.BallComponent (in module silke.learns.fxgl.pong.silkepong) with modifiers "private"

also protected does not work

Cannot inject Physics() into physics Error: java.lang.IllegalAccessException: class com.almasb.fxgl.core.reflect.ReflectionUtils (in module com.almasb.fxgl.core) cannot access a member of class silke.learns.fxgl.pong.silkepong.BallComponent (in module silke.learns.fxgl.pong.silkepong) with modifiers "protected"

public works.

This is my module info
module silke.learns.fxgl.pong.silkepong {
requires javafx.controls;
requires javafx.fxml;

requires org.controlsfx.controls;
requires org.kordamp.bootstrapfx.core;
requires com.almasb.fxgl.all;

opens silke.learns.fxgl.pong.silkepong to javafx.fxml;
exports silke.learns.fxgl.pong.silkepong;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions