Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix-#1201/refactor-design-smells#1202

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
bishaddebroy wants to merge1 commit intogoogle:master
base:master
Choose a base branch
Loading
frombishaddebroy:fix-#1201/refactor-design-smells

Conversation

bishaddebroy
Copy link

@bishaddebroybishaddebroy commentedNov 26, 2024
edited
Loading

Refactor JavacTokens to Address Design Smells

Description

This PR implements three refactorings in JavacTokens.java to address several identified design smells. The changes improve code organization and maintainability while maintaining all existing functionality.

Changes Made

1. Extract Class - TokenPosition

  • Created dedicated class for position management
  • Handles pos/endPos fields and related operations
  • Addresses "Unnecessary Abstraction" and "Multifaceted Abstraction" smells
  • Main affected classes: RawTok, CommentWithTextAndPosition

2. Move Method - Position Validation

  • Relocated validation logic to TokenPosition class
  • Validates position indices where position data lives
  • Addresses "Multifaceted Abstraction" smell
  • Improves cohesion of position-related operations

3. Move Field - Position Fields

  • Consolidated pos/endPos fields into TokenPosition
  • Removed duplicate fields from multiple classes
  • Addresses "Leaky Encapsulation" and "Duplicate Abstraction" smells
  • Ensures consistent position handling

Testing

  • All existing tests pass successfully
  • No changes to public APIs
  • Original functionality preserved
  • Verified backward compatibility

Implementation Notes

  • No behavioral changes made
  • Only internal refactoring for better organization
  • Maintains existing interfaces and contracts
  • Follows project coding standards

Related Issues

Resolves#1201 - Design smells in JavacTokens class

Documentation

  • Maintained existing documentation style

Change Impact

  • Risk Level: Low
  • Affected Components:
  • JavacTokens.java

Checklist

  • Code follows project style guidelines
  • All tests pass
  • No new warnings introduced

Additional Notes

These refactorings improve code quality while carefully preserving all existing behavior. The changes make the codebase more maintainable and reduce the likelihood of position-related errors.


/cc@reviewer1@reviewer2

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Design Smell Refactoring in JavacTokens
1 participant
@bishaddebroy

[8]ページ先頭

©2009-2025 Movatter.jp