Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NickyBoy89/java2go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Suhaibinator/java2go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 24 files changed
  • 3 contributors

Commits on Nov 30, 2025

  1. Add enum support and fix tests (#3)

    * Add enum support and fix tests
    
    - Fix failing tests by properly setting up symbol table context
    - Skip tests for unimplemented TypeInformation feature
    - Remove sample output files that caused package conflicts
    - Add line_comment and block_comment handling
    
    Enum support:
    - Parse enum constants from enum_declaration nodes
    - Generate Go type alias (type EnumName int)
    - Generate iota-based constants for enum values
    - Generate EnumNameValues() function for Java's .values() method
    - Transform Enum.values() calls to EnumNameValues()
    
    * Add CI workflow for testing, building, linting, and vulnerability checks
    
    * Update Go version to 1.25.1 in CI workflow
    
    * Update Go version to 1.25.4 in CI workflow
    
    * Refactor code for improved readability and maintainability; update comments and remove unused functions in typecheck_test.go
    
    ---------
    
    Co-authored-by: Claude <[email protected]>
    Suhaibinator and claude authored Nov 30, 2025
    Configuration menu
    Copy the full SHA
    4c21924 View commit details
    Browse the repository at this point in the history

Commits on Dec 17, 2025

  1. Add generics support for Java to Go transpilation (#4)

    * Add generics support for Java to Go transpilation
    
    This adds comprehensive support for Java generics in the transpiler:
    
    - Add TypeParameters field to ClassScope for tracking type parameters
    - Update ParseType to handle generic types with type arguments
    - Generate Go generic structs with type parameters (e.g., `type List[T any] struct`)
    - Generate generic constructors and methods with proper type parameter syntax
    - Handle diamond operator (<>) by inferring types from variable declarations
    - Support inner class constructors that inherit parent type parameters
    - Add expectedType context for type inference during object creation
    
    The implementation properly handles:
    - Generic class declarations with type parameters
    - Generic method receivers with type parameters
    - Constructor type arguments in generic struct instantiation
    - Diamond operator type inference from declaration context
    - Nested classes inheriting parent type parameters
    
    * Add tests for ParseNode and helpers, fix field type parsing (#5)
    
    - Added `tree_sitter_test.go` with unit tests for `CapitalizeIdent`, `LowercaseIdent`, and `Ctx.Clone`.
    - Added integration tests for `ParseNode` covering Programs, Interface Methods, Field Declarations, Try Statements, Parameters, Switch Labels, and Imports.
    - Fixed a bug in `tree_sitter.go` where `ParseNode` used `ParseExpr` instead of `astutil.ParseType` for field types, causing panics on primitive types.
    
    Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
    
    * Refactor TestParseNode_ImportDeclaration for consistency and readability
    
    * Add generics support for Java to Go transpilation
    
    This adds comprehensive support for Java generics in the transpiler:
    
    - Add TypeParameters field to ClassScope for tracking type parameters
    - Update ParseType to handle generic types with type arguments
    - Generate Go generic structs with type parameters (e.g., `type List[T any] struct`)
    - Generate generic constructors and methods with proper type parameter syntax
    - Handle diamond operator (<>) by inferring types from variable declarations
    - Support inner class constructors that inherit parent type parameters
    - Add expectedType context for type inference during object creation
    
    The implementation properly handles:
    - Generic class declarations with type parameters
    - Generic method receivers with type parameters
    - Constructor type arguments in generic struct instantiation
    - Diamond operator type inference from declaration context
    - Nested classes inheriting parent type parameters
    - Nested generic types like Map<String, List<Integer>>
    
    * Refactor inner class type argument logic for clarity
    
    Simplify the logic that determines type arguments for inner class
    constructors. The previous code had redundant checks and contradictory
    comments. Now the logic is clear:
    
    1. Use explicit type arguments if provided
    2. For diamond operator, infer from expectedType
    3. For inner class constructors (non-diamond), use parent class type params
    
    * Handle type parameter shadowing in nested classes
    
    When a nested class declares a type parameter with the same name as
    its parent's type parameter (e.g., class Outer<T> { class Inner<T> }),
    Java shadows the parent's parameter. Previously, both would appear in
    the TypeParameters slice causing duplicates.
    
    Now we properly handle shadowing: parent type parameters are only
    included if they aren't shadowed by the nested class's own parameters.
    
    * Refactor ParseTypeWithTypeParams to improve handling of indexed expressions for generic types
    
    * Enhance ParseExpr to support diamond operator and array initializers
    
    * Add support for diamond operator and raw type handling in tests
    
    * Enhance error messages for unhandled statement types and improve type argument extraction validation
    
    * Refactor return type construction in ParseDecl to simplify generics handling
    
    * Enhance ParseNode to support type parameters for field type parsing
    
    * feat: Update Go module dependencies and enhance type parameter handling
    
    - Bump Go version to 1.24.0 and update dependencies:
      - logrus from v1.9.0 to v1.9.3
      - go-tree-sitter from v0.0.0-20230113054119 to v0.0.0-20240827094217
      - golang.org/x/exp to v0.0.0-20251125195548
      - golang.org/x/sys to v0.38.0
    
    - Add TypeParameters field to Definition struct for better representation of type parameters in method and constructor definitions.
    
    - Refactor type parameter extraction into a dedicated function for cleaner code and improved readability.
    
    - Update parsing logic to correctly handle type parameters in method declarations and field declarations, ensuring that generic types are preserved.
    
    - Enhance test coverage for generic type parameters in method and field declarations, including tests for inner classes and variadic parameters.
    
    * feat: Add generics support with helper generation for instance methods
    
    * feat: Enhance generics support with helper generation for instance methods and add tests for type argument inference
    
    * feat: Add integration tests for generics support and enhance type argument handling in existing tests
    
    * feat: Improve generics support by adding nil checks for base types and type parameters in parsing functions
    
    ---------
    
    Co-authored-by: Claude <[email protected]>
    Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
    3 people authored Dec 17, 2025
    Configuration menu
    Copy the full SHA
    0c5d977 View commit details
    Browse the repository at this point in the history
Loading