Skip to content

Conversation

@Vivek504
Copy link

@Vivek504 Vivek504 commented Nov 15, 2023

Extract method refactoring

Class: org.apache.pdfbox.io.ScratchFile
Reason for refactoring: Complex method - Cyclomatic complexity of enlarge() method is 9.
Explanation of refactoring: Method is divided into multiple methods to reduce the cyclomatic complexity.

Decompose conditional refactoring

Class: org.apache.pdfbox.io.MemoryUsageSetting
Reason for refactoring: Complex Conditional - The conditional expression locUseMainMemory && (locMaxStorageBytes > -1) && ((locMaxMainMemoryBytes == -1) || (locMaxMainMemoryBytes > locMaxStorageBytes)) is complex.
Explanation of refactoring: Introduced new methods for conditional logic.

Introduce explaining variable refactoring

Class: org.apache.pdfbox.io.IOUtils
Reason for refactoring: Long Statement

  1. The length of the statement "final MethodHandle nonNullTest=lookup.findStatic(Objects.class,"nonNull",methodType(boolean.class,Object.class)).asType(methodType(boolean.class,cleanerClass));" is 160.
  2. The length of the statement "final MethodHandle unmapper=filterReturnValue(directBufferCleanerMethod,guardWithTest(nonNullTest,cleanMethod,noop)).asType(methodType(void.class,ByteBuffer.class));" is 165.

Explanation of refactoring: Complicated expressions are replaced by explaining variables.

@Vivek504 Vivek504 closed this by deleting the head repository Nov 18, 2023
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.

1 participant