Skip to content

Commit de009d9

Browse files
committed
Clean up warnings: remove unused imports, fields, methods, and suppress restriction/deprecation warnings
1 parent 49a4af6 commit de009d9

35 files changed

Lines changed: 19 additions & 175 deletions

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/commands/ProjectPreferencesCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.eclipse.core.runtime.CoreException;
1313

1414
import java.util.ArrayList;
15-
import java.util.Collections;
1615
import java.util.List;
1716

1817
/**

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/completion/GhostTextManager.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
public class GhostTextManager
3434
{
3535

36-
private final ITextViewer textViewer;
37-
3836
private final StyledText styledText;
3937

4038
private final UISynchronizeCallable uiSync;
@@ -49,8 +47,6 @@ public class GhostTextManager
4947

5048
// Track which line has vertical indent applied
5149
private int indentedLineIndex = -1;
52-
private int appliedIndent = 0;
53-
5450
// Listeners
5551
private KeyListener keyListener;
5652

@@ -70,7 +66,6 @@ public class GhostTextManager
7066

7167
public GhostTextManager( ITextViewer textViewer, UISynchronizeCallable uiSync )
7268
{
73-
this.textViewer = textViewer;
7469
this.styledText = textViewer.getTextWidget();
7570
this.uiSync = uiSync;
7671
this.isShowing = false;
@@ -372,7 +367,6 @@ private void updateVerticalIndent()
372367
int indent = extraLines * lineHeight;
373368
styledText.setLineVerticalIndent(nextLine, indent);
374369
indentedLineIndex = nextLine;
375-
appliedIndent = indent;
376370
}
377371
}
378372
catch (Exception e)
@@ -400,7 +394,6 @@ private void removeVerticalIndent()
400394
// Ignore
401395
}
402396
indentedLineIndex = -1;
403-
appliedIndent = 0;
404397
}
405398
}
406399

@@ -521,13 +514,10 @@ private void paintGhostText( PaintEvent event )
521514
int lineStartOffset = st.getOffsetAtLine( ghostLine );
522515
String currentLineText = st.getLine( ghostLine );
523516

524-
// Calculate indent (spaces/tabs at beginning)
525-
int indentChars = 0;
526517
for ( char c : currentLineText.toCharArray() )
527518
{
528519
if ( c == ' ' || c == '\t' )
529520
{
530-
indentChars++;
531521
}
532522
else
533523
{

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/mcp/local/InMemoryTransport.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ private static class InMemoryServerTransportProvider implements McpServerTranspo
220220
private final McpJsonMapper jsonMapper;
221221
private final BlockingQueue<McpSchema.JSONRPCMessage> inboundQueue;
222222
private final BlockingQueue<McpSchema.JSONRPCMessage> outboundQueue;
223-
private final Sinks.Many<String> errorSink;
224223
private final ILog logger;
225224
private McpServerSession session;
226225
private final AtomicBoolean isClosing = new AtomicBoolean(false);
@@ -241,7 +240,6 @@ private static class InMemoryServerTransportProvider implements McpServerTranspo
241240
this.jsonMapper = jsonMapper;
242241
this.inboundQueue = inboundQueue;
243242
this.outboundQueue = outboundQueue;
244-
this.errorSink = errorSink;
245243
this.logger = logger;
246244
}
247245

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/mcp/servers/DuckDuckSearchMcpServer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public class DuckDuckSearchMcpServer
2727
@Inject
2828
ILog logger;
2929

30-
@Tool(name="webSearch", description="Performs a search using a Duck Duck Go search engine and returns the search result json.", type="object")
30+
@SuppressWarnings("deprecation")
31+
@Tool(name="webSearch", description="Performs a search using a Duck Duck Go search engine and returns the search result json.", type="object")
3132
public String webSearch(
3233
@ToolParam(name="query", description="A search query", required=true) String query)
3334
{

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/mcp/services/CodeAnalysisService.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public class CodeAnalysisService
6363
* @param maxDepth Maximum depth of the call hierarchy to retrieve
6464
* @return A formatted string containing the call hierarchy
6565
*/
66-
public String getMethodCallHierarchy(String fullyQualifiedClassName,
66+
@SuppressWarnings("restriction")
67+
public String getMethodCallHierarchy(String fullyQualifiedClassName,
6768
String methodName,
6869
String methodSignature,
6970
Integer maxDepth)
@@ -391,7 +392,8 @@ private String readFileContent(IFile file) throws CoreException, IOException {
391392
}
392393
}
393394

394-
private void collectCallHierarchy(MethodWrapper[] callers, int level, int maxDepth, StringBuilder result) {
395+
@SuppressWarnings("restriction")
396+
private void collectCallHierarchy(MethodWrapper[] callers, int level, int maxDepth, StringBuilder result) {
395397

396398
if (level >= maxDepth)
397399
{
@@ -449,7 +451,8 @@ private void collectCallHierarchy(MethodWrapper[] callers, int level, int maxDep
449451
}
450452
}
451453

452-
private void collectCalleeHierarchy(MethodWrapper[] callees, int level, int maxDepth, StringBuilder result) {
454+
@SuppressWarnings("restriction")
455+
private void collectCalleeHierarchy(MethodWrapper[] callees, int level, int maxDepth, StringBuilder result) {
453456
if (level >= maxDepth)
454457
{
455458
return;
@@ -814,7 +817,8 @@ public String executeQuickFix(long markerId, int proposalIndex)
814817
*
815818
* Non-Java markers (PDE, m2e, build-path, etc.): uses IMarkerHelpRegistry and run().
816819
*/
817-
private List<QuickFix> collectQuickFixes(IMarker marker)
820+
@SuppressWarnings("restriction")
821+
private List<QuickFix> collectQuickFixes(IMarker marker)
818822
{
819823
List<QuickFix> fixes = new ArrayList<>();
820824
java.util.Set<String> seenLabels = new java.util.HashSet<>();

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/mcp/services/CodeEditingService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2554,7 +2554,6 @@ private static class DiffHunk
25542554
{
25552555
int originalStart; // 1-based line number in original file
25562556
int originalCount; // number of lines from original
2557-
List<String> contextAndRemoveLines = new java.util.ArrayList<>(); // context (' ') and remove ('-') lines
25582557
List<String> hunkLines = new java.util.ArrayList<>(); // all lines in the hunk with their prefixes
25592558
}
25602559

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/mcp/services/GitService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ else if (behind > 0)
159159
}
160160
}
161161

162-
public String getLog(String projectName, int maxCount)
162+
@SuppressWarnings("deprecation")
163+
public String getLog(String projectName, int maxCount)
163164
{
164165
Repository repository = getRepository(projectName);
165166
try (Git git = new Git(repository))
@@ -375,7 +376,7 @@ public String stashPop(String projectName)
375376
Repository repository = getRepository(projectName);
376377
try (Git git = new Git(repository))
377378
{
378-
var result = git.stashApply().call();
379+
git.stashApply().call();
379380
git.stashDrop().call();
380381
refreshProject(projectName);
381382
return "Applied and dropped stash.";

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/mcp/services/JavaLaunchService.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.github.gradusnikov.eclipse.assistai.mcp.services;
22

33
import java.util.ArrayList;
4-
import java.util.Arrays;
5-
import java.util.List;
64
import java.util.Objects;
75
import java.util.Optional;
86
import java.util.concurrent.CountDownLatch;
@@ -33,7 +31,6 @@
3331
import org.eclipse.jdt.core.IJavaProject;
3432
import org.eclipse.jdt.core.IType;
3533
import org.eclipse.jdt.core.JavaCore;
36-
import org.eclipse.jdt.debug.core.IJavaBreakpoint;
3734
import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
3835
import org.eclipse.jdt.debug.core.JDIDebugModel;
3936
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
@@ -148,8 +145,6 @@ private String launchJavaApplication(String projectName, String mainClass,
148145
// Capture output
149146
var outputBuffer = new StringBuilder();
150147
var errorBuffer = new StringBuilder();
151-
var latch = new CountDownLatch(1);
152-
153148
// Launch
154149
final ILaunch[] launchHolder = new ILaunch[1];
155150
sync.syncExec(() ->
@@ -771,7 +766,6 @@ public String evaluateExpression(String nameOrClass, String expression)
771766
{
772767
if (thread.isSuspended() && thread instanceof org.eclipse.jdt.debug.core.IJavaThread)
773768
{
774-
var javaThread = (org.eclipse.jdt.debug.core.IJavaThread) thread;
775769
IStackFrame[] frames = thread.getStackFrames();
776770
if (frames.length > 0 && frames[0] instanceof org.eclipse.jdt.debug.core.IJavaStackFrame)
777771
{

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/mcp/services/MarkdownService.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,14 @@
1111
import org.eclipse.core.resources.IProject;
1212
import org.eclipse.core.resources.ResourcesPlugin;
1313
import org.eclipse.core.runtime.CoreException;
14-
import org.eclipse.core.runtime.ILog;
1514
import org.eclipse.core.runtime.IPath;
1615
import org.eclipse.e4.core.di.annotations.Creatable;
1716

1817
import com.github.gradusnikov.eclipse.assistai.tools.ResourceUtilities;
1918

20-
import jakarta.inject.Inject;
21-
2219
@Creatable
2320
public class MarkdownService
2421
{
25-
@Inject
26-
private ILog logger;
27-
2822
private static final Pattern ATX_HEADING = Pattern.compile("^(#{1,6})\\s+(.+?)\\s*#*\\s*$");
2923
private static final Pattern SETEXT_H1 = Pattern.compile("^={3,}\\s*$");
3024
private static final Pattern SETEXT_H2 = Pattern.compile("^-{3,}\\s*$");

plugins/com.github.gradusnikov.eclipse.plugin.assistai.main/src/com/github/gradusnikov/eclipse/assistai/mcp/services/ProjectService.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,6 @@ public String getProjectProperties(String projectName)
277277
}
278278
}
279279

280-
/**
281-
* Collects resources in a hierarchical structure for display.
282-
*
283-
* @param resource The starting resource
284-
* @param depth The current depth in the hierarchy
285-
* @param result The StringBuilder to append results to
286-
* @throws CoreException if an error occurs
287-
*/
288-
private void collectResourcesForLLM(IResource resource, int depth, StringBuilder result) throws CoreException {
289-
collectResourcesForLLM(resource, depth, Integer.MAX_VALUE, result);
290-
}
291-
292280
private void collectResourcesForLLM(IResource resource, int depth, int maxDepth, StringBuilder result) throws CoreException {
293281
if (aiIgnoreService.isExcluded(resource))
294282
{

0 commit comments

Comments
 (0)