diff options
author | Markus Keller | 2015-11-30 19:23:22 +0000 |
---|---|---|
committer | Markus Keller | 2015-12-01 12:59:16 +0000 |
commit | 96da92a20589d62dad534245c5d9c4d45618ee95 (patch) | |
tree | db7f27dc0839db136db463ad28a7e763a6a07a91 /org.eclipse.core.filebuffers.tests | |
parent | 0bbe21e0e553957dd09eda0b29e8c77a98f38048 (diff) | |
download | eclipse.platform.text-96da92a20589d62dad534245c5d9c4d45618ee95.tar.gz eclipse.platform.text-96da92a20589d62dad534245c5d9c4d45618ee95.tar.xz eclipse.platform.text-96da92a20589d62dad534245c5d9c4d45618ee95.zip |
Bug 478673: generify codeI20151201-1100I20151201-0800
Diffstat (limited to 'org.eclipse.core.filebuffers.tests')
15 files changed, 49 insertions, 35 deletions
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java index 82830736bbd..ee6cb0fd44b 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java @@ -14,8 +14,6 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Set; -import junit.framework.TestCase; - import org.eclipse.core.runtime.Path; import org.eclipse.core.filebuffers.IDocumentSetupParticipantExtension; @@ -30,6 +28,8 @@ import org.eclipse.core.filebuffers.tests.MockDocumentSetupParticipants.TestDSP6 import org.eclipse.jface.text.IDocument; +import junit.framework.TestCase; + /** * @since 3.4 @@ -106,13 +106,13 @@ public abstract class AbstractFileBufferDocCreationTests extends TestCase { /* Utilities */ - private void assertParticipantsInvoked(String path, Class[] expectedDSPsArray) { + private void assertParticipantsInvoked(String path, Class<?>[] expectedDSPsArray) { LocationKind[] lks= getSupportLocationKinds(); for(int i=0; i<lks.length; i++) { IDocument document= fManager.createEmptyDocument(new Path(path), lks[i]); String content= document.get(); - Set expectedDSPs= new HashSet(Arrays.asList(toString(expectedDSPsArray))); - Set actualDSPs= new HashSet(Arrays.asList(content.split("\n"))); + Set<String> expectedDSPs= new HashSet<>(Arrays.asList(toString(expectedDSPsArray))); + Set<String> actualDSPs= new HashSet<>(Arrays.asList(content.split("\n"))); assertEquals(expectedDSPs, actualDSPs); } } @@ -123,7 +123,7 @@ public abstract class AbstractFileBufferDocCreationTests extends TestCase { assertEquals(expectedContent, fManager.createEmptyDocument(new Path(path), locKind).get()); } - private static String[] toString(Class[] clss) { + private static String[] toString(Class<?>[] clss) { String[] result= new String[clss.length]; for(int i=0; i<result.length; i++) { String s= null; diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java index 71533493dec..3881085b50a 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java @@ -14,8 +14,6 @@ package org.eclipse.core.filebuffers.tests; import java.io.PrintStream; import java.io.PrintWriter; -import junit.framework.TestCase; - import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileStore; @@ -35,6 +33,8 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentExtension4; import org.eclipse.jface.text.source.IAnnotationModel; +import junit.framework.TestCase; + /** * FileBufferFunctions */ @@ -57,7 +57,7 @@ public abstract class FileBufferFunctions extends TestCase { protected abstract boolean isStateValidationSupported(); - protected abstract Class getAnnotationModelClass() throws Exception; + protected abstract Class<IAnnotationModel> getAnnotationModelClass() throws Exception; @Override @@ -1109,7 +1109,7 @@ public abstract class FileBufferFunctions extends TestCase { ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE); assertNotNull(buffer); - Class clazz= getAnnotationModelClass(); + Class<IAnnotationModel> clazz= getAnnotationModelClass(); if (clazz != null) { IAnnotationModel model= buffer.getAnnotationModel(); assertTrue(clazz.isInstance(model)); @@ -1176,7 +1176,7 @@ public abstract class FileBufferFunctions extends TestCase { ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE); assertNotNull(buffer); - Class clazz= getAnnotationModelClass(); + Class<IAnnotationModel> clazz= getAnnotationModelClass(); if (clazz != null) { IAnnotationModel model= buffer.getAnnotationModel(); assertTrue(clazz.isInstance(model)); @@ -1216,7 +1216,7 @@ public abstract class FileBufferFunctions extends TestCase { try { ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fileStore); IAnnotationModel model= fileBuffer.getAnnotationModel(); - Class clazz= getAnnotationModelClass(); + Class<IAnnotationModel> clazz= getAnnotationModelClass(); if (clazz != null) assertTrue(clazz.isInstance(model)); else diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java index 6f165eb60f3..b5840cbc3c5 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java @@ -22,6 +22,8 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.filebuffers.FileBuffers; +import org.eclipse.jface.text.source.IAnnotationModel; + /** * FileBuffersForExternalFiles */ @@ -70,7 +72,7 @@ public class FileBuffersForExternalFiles extends FileBufferFunctions { } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { return null; } } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java index 55dc5ec0938..add40638ef3 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java @@ -125,7 +125,7 @@ public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions { } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { Bundle bundle= Platform.getBundle("org.eclipse.ui.editors"); return bundle != null ? IAnnotationModel.class : null; } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java index 26a35228861..6977a6b4712 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java @@ -97,7 +97,7 @@ public class FileBuffersForLinkedFiles extends FileBufferFunctions { } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { Bundle bundle= Platform.getBundle("org.eclipse.ui.editors"); return bundle != null ? IAnnotationModel.class : null; } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java index f2526d51873..d4c1a9f1ca4 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java @@ -21,6 +21,8 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.filebuffers.FileBuffers; +import org.eclipse.jface.text.source.IAnnotationModel; + /** * FileBuffersForWorkspaceFiles */ @@ -77,7 +79,7 @@ public class FileBuffersForNonAccessibleWorkspaceFiles extends FileBufferFunctio } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { return null; } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java index ccf40bd5e14..e070b56e215 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java @@ -20,6 +20,8 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.filebuffers.FileBuffers; +import org.eclipse.jface.text.source.IAnnotationModel; + /** * FileBuffersForNonExistingExternalFiles */ @@ -69,7 +71,7 @@ public class FileBuffersForNonExistingExternalFiles extends FileBufferFunctions } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { return null; } } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java index 7629120ddcc..3484b862d08 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java @@ -23,6 +23,8 @@ import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.filebuffers.ITextFileBuffer; import org.eclipse.core.filebuffers.LocationKind; +import org.eclipse.jface.text.source.IAnnotationModel; + /** * FileBuffersForNonExistingWorkspaceFiles */ @@ -101,7 +103,7 @@ public class FileBuffersForNonExistingWorkspaceFiles extends FileBufferFunctions } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { return null; } } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java index 7f703dd39a8..d4627276b33 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java @@ -105,7 +105,7 @@ public class FileBuffersForWorkspaceFiles extends FileBufferFunctions { } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { Bundle bundle= Platform.getBundle("org.eclipse.ui.editors"); return bundle != null ? IAnnotationModel.class : null; } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java index 5a4b6a2dbcb..b6d985fea9e 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,8 +13,6 @@ package org.eclipse.core.filebuffers.tests; import java.io.PrintStream; import java.io.PrintWriter; -import junit.framework.TestCase; - import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileStore; @@ -33,6 +31,8 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentExtension4; import org.eclipse.jface.text.source.IAnnotationModel; +import junit.framework.TestCase; + /** * FileBufferFunctions */ @@ -55,7 +55,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { protected abstract boolean isStateValidationSupported(); - protected abstract Class getAnnotationModelClass() throws Exception; + protected abstract Class<IAnnotationModel> getAnnotationModelClass() throws Exception; @Override @@ -1095,7 +1095,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { ITextFileBuffer buffer= fManager.getFileStoreTextFileBuffer(fFileStore); assertNotNull(buffer); - Class clazz= getAnnotationModelClass(); + Class<IAnnotationModel> clazz= getAnnotationModelClass(); if (clazz != null) { IAnnotationModel model= buffer.getAnnotationModel(); assertTrue(clazz.isInstance(model)); @@ -1162,7 +1162,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { ITextFileBuffer buffer= fManager.getFileStoreTextFileBuffer(fFileStore); assertNotNull(buffer); - Class clazz= getAnnotationModelClass(); + Class<IAnnotationModel> clazz= getAnnotationModelClass(); if (clazz != null) { IAnnotationModel model= buffer.getAnnotationModel(); assertTrue(clazz.isInstance(model)); diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java index de05cffeb1d..de02b912946 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,8 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.filebuffers.FileBuffers; +import org.eclipse.jface.text.source.IAnnotationModel; + /** * FileBuffersForExternalFiles */ @@ -70,7 +72,7 @@ public class FileStoreFileBuffersForExternalFiles extends FileStoreFileBufferFun } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { return null; } } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java index 1484e941c21..ad1f6c91de9 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,6 +20,8 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.filebuffers.FileBuffers; +import org.eclipse.jface.text.source.IAnnotationModel; + /** * FileBuffersForNonExistingExternalFiles */ @@ -69,7 +71,7 @@ public class FileStoreFileBuffersForNonExistingExternalFiles extends FileStoreFi } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { return null; } } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java index 9c50e9a9a32..2da4f6f1bb5 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,6 +23,8 @@ import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.filebuffers.ITextFileBuffer; import org.eclipse.core.filebuffers.LocationKind; +import org.eclipse.jface.text.source.IAnnotationModel; + /** * FileBuffersForNonExistingWorkspaceFiles */ @@ -101,7 +103,7 @@ public class FileStoreFileBuffersForNonExistingWorkspaceFiles extends FileStoreF } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { return null; } } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java index 22a7d3a204b..dcf49abe98f 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java @@ -105,7 +105,7 @@ public class FileStoreFileBuffersForWorkspaceFiles extends FileBufferFunctions { } @Override - protected Class getAnnotationModelClass() throws Exception { + protected Class<IAnnotationModel> getAnnotationModelClass() throws Exception { Bundle bundle= Platform.getBundle("org.eclipse.ui.editors"); return bundle != null ? IAnnotationModel.class : null; } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java index 7d88be8dd12..022c8c94de8 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -53,11 +53,11 @@ public class FileTool { */ public static void unzip(ZipFile zipFile, File dstDir) throws IOException { - Enumeration entries = zipFile.entries(); + Enumeration<? extends ZipEntry> entries = zipFile.entries(); try { while(entries.hasMoreElements()){ - ZipEntry entry = (ZipEntry)entries.nextElement(); + ZipEntry entry = entries.nextElement(); if(entry.isDirectory()){ continue; } |