-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from Roenke/plugin-review-fixes
Fixes after plugin overview/testing
- Loading branch information
Showing
32 changed files
with
448 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericTypeUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2000-2017 JetBrains s.r.o. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.intellij.debugger.streams.trace.impl.handler.type; | ||
|
||
import com.intellij.psi.CommonClassNames; | ||
import com.intellij.psi.PsiType; | ||
import com.intellij.psi.util.InheritanceUtil; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* @author Vitaliy.Bibaev | ||
*/ | ||
public class GenericTypeUtil { | ||
|
||
public static GenericType fromStreamPsiType(@NotNull PsiType streamPsiType) { | ||
if (InheritanceUtil.isInheritor(streamPsiType, CommonClassNames.JAVA_UTIL_STREAM_INT_STREAM)) return GenericType.INT; | ||
if (InheritanceUtil.isInheritor(streamPsiType, CommonClassNames.JAVA_UTIL_STREAM_LONG_STREAM)) return GenericType.LONG; | ||
if (InheritanceUtil.isInheritor(streamPsiType, CommonClassNames.JAVA_UTIL_STREAM_DOUBLE_STREAM)) return GenericType.DOUBLE; | ||
if (PsiType.VOID.equals(streamPsiType)) return GenericType.VOID; | ||
|
||
return GenericType.OBJECT; | ||
} | ||
|
||
public static GenericType fromPsiType(@NotNull PsiType type) { | ||
if (PsiType.VOID.equals(type)) return GenericType.VOID; | ||
if (PsiType.INT.equals(type)) return GenericType.INT; | ||
if (PsiType.DOUBLE.equals(type)) return GenericType.DOUBLE; | ||
if (PsiType.LONG.equals(type)) return GenericType.LONG; | ||
if (PsiType.BOOLEAN.equals(type)) return GenericType.BOOLEAN; | ||
return GenericType.OBJECT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/test/java/com/intellij/debugger/streams/chain/positive/TerminationCallTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2000-2017 JetBrains s.r.o. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.intellij.debugger.streams.chain.positive; | ||
|
||
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType; | ||
import com.intellij.debugger.streams.wrapper.StreamChain; | ||
import com.intellij.psi.PsiElement; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* @author Vitaliy.Bibaev | ||
*/ | ||
public class TerminationCallTypeTest extends StreamChainBuilderPositiveTestBase { | ||
public void testVoidType() throws Exception { | ||
doTest(GenericType.VOID); | ||
} | ||
|
||
public void testBooleanType() throws Exception { | ||
doTest(GenericType.BOOLEAN); | ||
} | ||
|
||
public void testIntType() throws Exception { | ||
doTest(GenericType.INT); | ||
} | ||
|
||
public void testDoubleType() throws Exception { | ||
doTest(GenericType.DOUBLE); | ||
} | ||
|
||
public void testLongType() throws Exception { | ||
doTest(GenericType.LONG); | ||
} | ||
|
||
public void testReferenceType() throws Exception { | ||
doTest(GenericType.OBJECT); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
protected String getDirectoryName() { | ||
return "terminationType"; | ||
} | ||
|
||
protected void doTest(@NotNull GenericType returnType) throws Exception { | ||
final PsiElement elementAtCaret = configureAndGetElementAtCaret(); | ||
assertNotNull(elementAtCaret); | ||
final StreamChain chain = getChainBuilder().build(elementAtCaret); | ||
assertNotNull(chain); | ||
assertEquals(returnType, chain.getTerminationCall().getResultType()); | ||
} | ||
|
||
@Override | ||
protected void checkResultChain(StreamChain chain) { | ||
} | ||
} |
Oops, something went wrong.