Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#13 transform java to kotlin #17

Merged
merged 19 commits into from
Jan 27, 2024

Conversation

DivineThreepwood
Copy link
Member

  • transform java to kotlin
  • link against latest jul version
  • setup github action pipeline

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@@ -130,3 +134,18 @@
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
kotlin {
jvmToolchain(17)

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
@tommy33790 tommy33790 self-requested a review January 24, 2024 20:47
Copy link
Contributor

@tommy33790 tommy33790 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swat-Teams don't seem to work and affect all agents instead.

Reproduction steps:

  1. Create Rule "Wall Collision" swat COMMANDER inCase {agent.isCollisionDetected} then {agent.turnRandom()}
  2. See that all agents avoid the wall

Edit:
This was further tested using the following rule and teams:
"Wall Collisions" swat [team noted below] inCase {agent.isCollisionDetected} then {agent.turnRandom()}

  • COMMANDER affects all
  • NOT_COMMANDER affects all
  • BRAVO affects all
  • NOT_BRAVO affects all

Additionally, "Wall Collisions" commander inCase {agent.isCollisionDetected} then {agent.turnRandom()} affects all too.

It must be noted that the old-styled rule creation behaves differently:

createRule(object: Rule("Wall Collision old", [team noted below]){
    override fun constraint(): Boolean {
        return agent.isCollisionDetected
    }

    override fun action() {
        agent.turnRandom()
    }
})
  • COMMANDER affects commander only
  • NOT_COMMANDER affects all
  • BRAVO affects Bravo only
  • NOT_BRAVO affects all

For all tests SwatTeam BRAVO was configured using:

override fun loadSwatTeams() {
    createSwat(BRAVO, 1,2)
}

@DivineThreepwood
Copy link
Member Author

Thanks for the detailed error description. Since the new Kotlin DSL is just one optional Feature and not fully related to the java -> kotlin transformation I would go for handling that by a dedicated bug ticket: https://github.com/openbase/planetsudo/issues/18 if this is fine for you.

@DivineThreepwood DivineThreepwood merged commit 739a18e into dev Jan 27, 2024
4 checks passed
@DivineThreepwood DivineThreepwood deleted the feature/#13_transform_java_to_kotlin branch January 27, 2024 04:30
@DivineThreepwood DivineThreepwood linked an issue Feb 5, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transform Project to Kotlin Property State file causes issues once shared between ai and engine
2 participants