diff --git a/NOTICE b/NOTICE
index 7c80c51c..7f27c9f8 100644
--- a/NOTICE
+++ b/NOTICE
@@ -30,7 +30,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Unless otherwise stated in the code/commit message, any changes with the
-committer of bgruv@google.com or wkal@google.com is copyrighted by
+committer of bgruv@google.com or wkal@google.com is copyrighted by
Google Inc. and released under the following license:
*******************************************************************************
@@ -77,26 +77,6 @@ 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.
-*******************************************************************************
-
-
-Some parts of the smalidea plugin are based on code from the IDEA project, per the
-following license
-
-*******************************************************************************
-Copyright 2000-2014 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.
diff --git a/settings.gradle b/settings.gradle
index f7a6cf75..6c4f08cf 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,5 +1 @@
-include 'util', 'dexlib2', 'baksmali', 'smali', 'dexlib2:accessorTestGenerator'
-
-if (System.getProperty("user.dir").startsWith(file("smalidea").absolutePath)) {
- include 'smalidea'
-}
\ No newline at end of file
+include 'util', 'dexlib2', 'baksmali', 'smali', 'dexlib2:accessorTestGenerator'
\ No newline at end of file
diff --git a/smalidea/.gitignore b/smalidea/.gitignore
deleted file mode 100644
index f8be3996..00000000
--- a/smalidea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-build
-test-config
-test-system
diff --git a/smalidea/build.gradle b/smalidea/build.gradle
deleted file mode 100644
index 57209762..00000000
--- a/smalidea/build.gradle
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright 2013, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-buildscript {
- repositories {
- maven {
- url "https://plugins.gradle.org/m2/"
- }
- maven {
- url 'http://dl.bintray.com/jetbrains/intellij-plugin-service'
- }
-
- }
- dependencies {
- classpath "gradle.plugin.org.jetbrains:gradle-intellij-plugin:0.1.10"
- }
-}
-
-apply plugin: 'java'
-apply plugin: 'idea'
-apply plugin: 'antlr'
-
-
-version = '0.05'
-
-if (!('release' in gradle.startParameter.taskNames)) {
- def versionSuffix
- try {
- def git = org.eclipse.jgit.api.Git.open(file('..'))
- def head = git.getRepository().getRef('HEAD')
- versionSuffix = head.getObjectId().abbreviate(8).name()
-
- if (!git.status().call().clean) {
- versionSuffix += '-dirty'
- }
- } catch (Exception ex) {
- // In case we can't get the commit for some reason,
- // just use -dev
- versionSuffix = 'dev'
- }
-
- def baseVersion = version
- version = baseVersion + '-' + versionSuffix
-} else {
- if (System.env.JDK7_HOME == null && !JavaVersion.current().isJava7()) {
- throw new InvalidUserDataException("bzzzzzzzt. Release builds must be performed with java 7. " +
- "Either run gradle with java 7, or define the JDK7_HOME environment variable.")
- }
-}
-
-if (System.env.JDK7_HOME != null) {
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
-
- tasks.withType(JavaCompile) {
- doFirst {
- options.fork = true
- options.bootClasspath = "$System.env.JDK7_HOME/jre/lib/rt.jar"
- options.bootClasspath += "$File.pathSeparator$System.env.JDK7_HOME/jre/lib/jsse.jar"
- }
- }
-}
-
-def sandboxDir = "${buildDir}/sandbox"
-
-if (!('idea' in gradle.startParameter.taskNames)) {
-
- apply plugin: 'org.jetbrains.intellij'
-
- intellij {
- version 'IC-2016.3.5'
- pluginName 'smalidea'
-
- updateSinceUntilBuild false
-
- sandboxDirectory sandboxDir
- }
-
- // This prints out the directories that can be used to configure a plugin sdk in IDEA, using
- // the copy of IDEA downloaded by the org.jetbrains.intellij plugin
- task ideaDirs() {
- project.afterEvaluate {
- if (intellij != null) {
- println "IDEA Plugin jdk: ${intellij.ideaDependency.classes}"
- println "sources: ${intellij.ideaDependency.getSources()}"
- }
- }
- }
-
- dependencies {
- compile files("${System.properties['java.home']}/../lib/tools.jar")
- }
-
-} else {
- project(':') {
- idea {
- project {
- ipr {
- withXml {
- def node = it.asNode()
-
- /*node.find { it.@name == 'ProjectRootManager' }
- .@'project-jdk-type' = 'IDEA JDK'*/
-
- def componentNode = node.find { it.@name == 'ProjectRunConfigurationManager' }
- if (componentNode == null) {
- componentNode = it.node.appendNode 'component', [name: 'ProjectRunConfigurationManager']
- }
-
- if (componentNode.find { it.@name == 'All smalidea tests' } == null) {
- componentNode.append(new XmlParser().parseText("""
-
-
-
-
-
-
-
-
-
- """))
- }
- }
- }
- }
- }
- }
-
- idea {
- module {
- jdkName = 'IDEA Plugin jdk'
-
- excludeDirs -= buildDir
- if (buildDir.exists()) {
- excludeDirs.addAll(buildDir.listFiles())
- }
-
- for (sourceDir in (sourceDirs + testSourceDirs)) {
- excludeDirs.remove(sourceDir);
- while ((sourceDir = sourceDir.getParentFile()) != null) {
- excludeDirs.remove(sourceDir);
- }
- }
-
- iml {
- withXml {
- def node = it.node
-
- node.@type = 'PLUGIN_MODULE'
-
- def pluginUrl = 'file://$MODULE_DIR$/src/main/resources/META-INF/plugin.xml'
-
- def pluginNode = node.find { it.@name == 'DevKit.ModuleBuildProperties' }
- if (pluginNode == null) {
- node.appendNode 'component', [name: 'DevKit.ModuleBuildProperties',
- url : pluginUrl]
- } else {
- pluginNode.@url = pluginUrl
- }
- }
- }
- }
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
-}
-
-dependencies {
- compile project(':smali')
- compile depends.antlr_runtime
- compile depends.gson
-
- antlr depends.antlr
-}
-
-task extractTokens(type: org.gradle.api.tasks.Copy, dependsOn: ':smali:build') {
- project.afterEvaluate {
- def allArtifacts = configurations.default.resolvedConfiguration.resolvedArtifacts
- def smaliArtifact = allArtifacts.find { it.moduleVersion.id.name.equals('smali') }
-
- from(zipTree(smaliArtifact.file)) {
- include '**/*.tokens'
- }
- into "${buildDir}/tokens"
- }
-}
-
-generateGrammarSource {
- def tokensDir = file("${buildDir}/tokens/org/jf/smali")
- inputs.file new File(tokensDir, 'smaliParser.tokens')
- setArguments(['-lib', tokensDir.path])
- outputDirectory(file("${buildDir}/generated-src/antlr/main/org/jf/smalidea"))
-}
-generateGrammarSource.dependsOn(extractTokens)
-ideaModule.dependsOn(generateGrammarSource)
-
-task release(dependsOn: 'buildPlugin') {
-}
-
-tasks.getByPath('idea').dependsOn(project(':').getTasksByName('idea', true).findAll({
- it.project.name != 'smalidea'
-}))
\ No newline at end of file
diff --git a/smalidea/src/main/antlr/smalideaParser.g b/smalidea/src/main/antlr/smalideaParser.g
deleted file mode 100644
index f0eaf0e1..00000000
--- a/smalidea/src/main/antlr/smalideaParser.g
+++ /dev/null
@@ -1,1364 +0,0 @@
-/*
- * [The "BSD licence"]
- * Copyright (c) 2010 Ben Gruver
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-parser grammar smalideaParser;
-
-options {
- tokenVocab=smaliParser;
-}
-
-@header {
-package org.jf.smalidea;
-
-import com.intellij.lang.PsiBuilder;
-import com.intellij.lang.PsiBuilder.Marker;
-import com.intellij.psi.tree.IElementType;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-}
-
-
-@members {
- private PsiBuilder psiBuilder;
-
- public void setPsiBuilder(PsiBuilder psiBuilder) {
- this.psiBuilder = psiBuilder;
- }
-
- public Marker mark() {
- return psiBuilder.mark();
- }
-
- protected void syncToFollows(boolean acceptEof) {
- BitSet follow = computeErrorRecoverySet();
- int mark = input.mark();
- Marker marker = null;
- try {
- int token = input.LA(1);
- while (!follow.member(token)) {
- if (token == Token.EOF) {
- if (acceptEof) {
- break;
- }
- input.rewind(mark);
- mark = -1;
- marker = null;
- return;
- }
- if (marker == null) {
- marker = mark();
- }
- input.consume();
- token = input.LA(1);
- }
- } finally {
- if (mark != -1) {
- input.release(mark);
- }
- if (marker != null) {
- marker.error("Unexpected tokens");
- }
- }
- }
-
- @Override
- public void recover(IntStream input, RecognitionException re) {
- BitSet followSet = computeErrorRecoverySet();
- beginResync();
- consumeUntil(input, followSet);
- endResync();
- }
-
- @Override
- protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow)
- throws RecognitionException
- {
- RecognitionException e = null;
- // if next token is what we are looking for then "delete" this token
- if ( mismatchIsUnwantedToken(input, ttype) ) {
- e = new UnwantedTokenException(ttype, input);
- beginResync();
- Marker mark = mark();
- input.consume(); // simply delete extra token
- mark.error(getErrorMessage(e, tokenNames));
- endResync();
- reportError(null, e, true); // report after consuming so AW sees the token in the exception
- // we want to return the token we're actually matching
- Object matchedSymbol = getCurrentInputSymbol(input);
- input.consume(); // move past ttype token as if all were ok
- return matchedSymbol;
- }
- // can't recover with single token deletion, try insertion
- if ( mismatchIsMissingToken(input, follow) ) {
- Object inserted = getMissingSymbol(input, e, ttype, follow);
- Marker mark = mark();
- e = new MissingTokenException(ttype, input, inserted);
- mark.error(getErrorMessage(e, tokenNames));
- reportError(null, e, true); // report after inserting so AW sees the token in the exception
- return inserted;
- }
-
- // even that didn't work; must throw the exception
- e = new MismatchedTokenException(ttype, input);
- throw e;
- }
-
- @Override
- public void reportError(RecognitionException e) {
- reportError(mark(), e, false);
- }
-
- public void reportError(@Nullable Marker marker, RecognitionException e, boolean alreadyReported) {
- // if we've already reported an error and have not matched a token
- // yet successfully, don't report any errors.
- if ( state.errorRecovery ) {
- if (marker != null) {
- marker.drop();
- }
- return;
- }
- state.syntaxErrors++; // don't count spurious
- state.errorRecovery = true;
-
- if (marker != null) {
- if (!alreadyReported) {
- displayRecognitionError(marker, this.getTokenNames(), e);
- } else {
- marker.drop();
- }
- }
- }
-
- public void finishToken(Marker marker, IElementType elementType) {
- if (state.errorRecovery) {
- marker.drop();
- } else {
- marker.done(elementType);
- }
- }
-
- @Override
- public void displayRecognitionError(String[] tokenNames, RecognitionException e) {
- displayRecognitionError(mark(), tokenNames, e);
- }
-
- public void displayRecognitionError(@Nonnull Marker marker, String[] tokenNames, RecognitionException e) {
- marker.error(getErrorMessage(e, tokenNames));
- }
-}
-
-sync[boolean toEof]
- @init { syncToFollows($toEof); }
- : /*epsilon*/;
-
-smali_file
- @init {
- mark().done(SmaliElementTypes.EXTENDS_LIST);
- mark().done(SmaliElementTypes.IMPLEMENTS_LIST);
- }
- :
- (
- ( class_spec
- | super_spec
- | implements_spec
- | source_spec
- | method
- | field
- | annotation
- )
- sync[true]
- )+
- EOF;
-
-class_spec
- @init { Marker marker = mark(); }
- : CLASS_DIRECTIVE class_access_list class_descriptor
- { marker.done(SmaliElementTypes.CLASS_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-super_spec
- @init { Marker marker = mark(); }
- : SUPER_DIRECTIVE class_descriptor
- { marker.done(SmaliElementTypes.SUPER_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-implements_spec
- @init { Marker marker = mark(); }
- : IMPLEMENTS_DIRECTIVE class_descriptor
- { marker.done(SmaliElementTypes.IMPLEMENTS_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-source_spec
- @init { Marker marker = mark(); }
- : SOURCE_DIRECTIVE string_literal
- { marker.done(SmaliElementTypes.SOURCE_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-// class_access_list should be separate from access_list, because
-// it exists in a slightly different context, and can consume
-// ACCESS_SPECs greedily, without having to look ahead.
-class_access_list
- @init { Marker marker = mark(); }
- : ACCESS_SPEC*
- { marker.done(SmaliElementTypes.MODIFIER_LIST); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-access_list
- @init { Marker marker = mark(); }
- : ACCESS_SPEC*
- { marker.done(SmaliElementTypes.MODIFIER_LIST); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-/*When there are annotations immediately after a field definition, we don't know whether they are field annotations
-or class annotations until we determine if there is an .end field directive. In either case, we still "consume" and parse
-the annotations. If it turns out that they are field annotations, we include them in the I_FIELD AST. Otherwise, we
-add them to the $smali_file::classAnnotations list*/
-field
- @init {
- Marker marker = mark();
- Marker annotationsMarker = null;
- boolean gotEndField = false;
- }
- : FIELD_DIRECTIVE
- access_list
- member_name colon nonvoid_type_descriptor
- field_initializer?
- (
- (ANNOTATION_DIRECTIVE)=> (
- { annotationsMarker = mark(); }
- ((ANNOTATION_DIRECTIVE)=> annotation)+
- )
- )?
- ( end_field_directive { gotEndField = true; } )?
- {
- if (annotationsMarker != null) {
- if (gotEndField) {
- annotationsMarker.drop();
- marker.done(SmaliElementTypes.FIELD);
- } else {
- marker.doneBefore(SmaliElementTypes.FIELD, annotationsMarker);
- annotationsMarker.drop();
- }
- } else {
- marker.done(SmaliElementTypes.FIELD);
- }
- };
- catch [RecognitionException re] {
- if (annotationsMarker != null) {
- annotationsMarker.drop();
- }
- recover(input, re);
- reportError(marker, re, false);
- }
-
-end_field_directive
- : END_FIELD_DIRECTIVE;
-
-field_initializer
- @init { Marker marker = mark(); }
- : EQUAL literal
- { marker.done(SmaliElementTypes.FIELD_INITIALIZER); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-method
- @init {
- Marker marker = mark();
- mark().done(SmaliElementTypes.THROWS_LIST);
- }
- : METHOD_DIRECTIVE access_list member_name method_prototype statements_and_directives
- end_method_directive
- { marker.done(SmaliElementTypes.METHOD); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-end_method_directive
- : END_METHOD_DIRECTIVE;
-catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-statements_and_directives
- : (
- ( ordered_method_item
- | registers_directive
- | catch_directive
- | catchall_directive
- | parameter_directive
- | annotation
- )
- sync[false]
- )*;
-
-/* Method items whose order/location is important */
-ordered_method_item
- : label
- | instruction
- | debug_directive;
-
-registers_directive
- @init { Marker marker = mark(); }
- : (
- REGISTERS_DIRECTIVE integral_literal
- | LOCALS_DIRECTIVE integral_literal
- )
- { marker.done(SmaliElementTypes.REGISTERS_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-param_list_or_id
- : PARAM_LIST_OR_ID_PRIMITIVE_TYPE+;
-
-/*identifiers are much more general than most languages. Any of the below can either be
-the indicated type OR an identifier, depending on the context*/
-simple_name
- : SIMPLE_NAME
- | ACCESS_SPEC
- | VERIFICATION_ERROR_TYPE
- | POSITIVE_INTEGER_LITERAL
- | NEGATIVE_INTEGER_LITERAL
- | FLOAT_LITERAL_OR_ID
- | DOUBLE_LITERAL_OR_ID
- | BOOL_LITERAL
- | NULL_LITERAL
- | register
- | param_list_or_id
- | PRIMITIVE_TYPE
- | VOID_TYPE
- | ANNOTATION_VISIBILITY
- | INSTRUCTION_FORMAT10t
- | INSTRUCTION_FORMAT10x
- | INSTRUCTION_FORMAT10x_ODEX
- | INSTRUCTION_FORMAT11x
- | INSTRUCTION_FORMAT12x_OR_ID
- | INSTRUCTION_FORMAT21c_FIELD
- | INSTRUCTION_FORMAT21c_FIELD_ODEX
- | INSTRUCTION_FORMAT21c_STRING
- | INSTRUCTION_FORMAT21c_TYPE
- | INSTRUCTION_FORMAT21t
- | INSTRUCTION_FORMAT22c_FIELD
- | INSTRUCTION_FORMAT22c_FIELD_ODEX
- | INSTRUCTION_FORMAT22c_TYPE
- | INSTRUCTION_FORMAT22cs_FIELD
- | INSTRUCTION_FORMAT22s_OR_ID
- | INSTRUCTION_FORMAT22t
- | INSTRUCTION_FORMAT23x
- | INSTRUCTION_FORMAT31i_OR_ID
- | INSTRUCTION_FORMAT31t
- | INSTRUCTION_FORMAT35c_METHOD
- | INSTRUCTION_FORMAT35c_METHOD_ODEX
- | INSTRUCTION_FORMAT35c_METHOD_OR_METHOD_HANDLE_TYPE
- | INSTRUCTION_FORMAT35c_TYPE
- | INSTRUCTION_FORMAT35mi_METHOD
- | INSTRUCTION_FORMAT35ms_METHOD
- | INSTRUCTION_FORMAT51l;
-
-member_name
- @init { Marker marker = mark(); }
- : member_name_inner
- { marker.done(SmaliElementTypes.MEMBER_NAME); };
-
-member_name_inner
- : (simple_name
- | MEMBER_NAME);
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-method_prototype
- @init { Marker marker = mark(); }
- : open_paren param_list close_paren type_descriptor
- { marker.done(SmaliElementTypes.METHOD_PROTOTYPE); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-open_paren
- : OPEN_PAREN;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-close_paren
- : CLOSE_PAREN;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-open_brace
- : OPEN_BRACE;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-close_brace
- : CLOSE_BRACE;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-comma
- : COMMA;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-colon
- : COLON;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-dotdot
- : DOTDOT;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-param_list_inner
- : param+;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-param_list
- @init { Marker marker = mark(); }
- : param_list_inner?
- { marker.done(SmaliElementTypes.METHOD_PARAM_LIST); };
-
-param
- @init {
- Marker marker = mark();
- mark().done(SmaliElementTypes.MODIFIER_LIST);
- }
- : nonvoid_type_descriptor
- { marker.done(SmaliElementTypes.METHOD_PARAMETER); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-method_prototype_reference
- : open_paren param_list_reference close_paren type_descriptor;
-
-param_list_reference
- @init {
- Marker marker = mark();
- }
- : nonvoid_type_descriptor*
- { marker.done(SmaliElementTypes.METHOD_REFERENCE_PARAM_LIST); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-primitive_type
- @init { Marker marker = mark(); }
- : (PRIMITIVE_TYPE | PARAM_LIST_OR_ID_PRIMITIVE_TYPE)
- { finishToken(marker, SmaliElementTypes.PRIMITIVE_TYPE); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-class_descriptor
- @init { Marker marker = mark(); }
- : CLASS_DESCRIPTOR
- { finishToken(marker, SmaliElementTypes.CLASS_TYPE); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-array_descriptor
- @init { Marker marker = mark(); }
- : ARRAY_TYPE_PREFIX (primitive_type | class_descriptor)
- { finishToken(marker, SmaliElementTypes.ARRAY_TYPE); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-void_type
- @init { Marker marker = mark(); }
- : VOID_TYPE
- { finishToken(marker, SmaliElementTypes.VOID_TYPE); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-type_descriptor
- : void_type
- | primitive_type
- | class_descriptor
- | array_descriptor;
- catch [RecognitionException re] {
- Marker marker = mark();
- recover(input, re);
- reportError(marker, re, false);
- }
-
-nonvoid_type_descriptor
- : primitive_type
- | class_descriptor
- | array_descriptor;
- catch [RecognitionException re] {
- Marker marker = mark();
- recover(input, re);
- reportError(marker, re, false);
- }
-
-reference_type_descriptor
- : class_descriptor
- | array_descriptor;
- catch [RecognitionException re] {
- Marker marker = mark();
- recover(input, re);
- reportError(marker, re, false);
- }
-
-null_literal
- @init { Marker marker = mark(); }
- : NULL_LITERAL
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-bool_literal
- @init { Marker marker = mark(); }
- : BOOL_LITERAL
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-byte_literal
- @init { Marker marker = mark(); }
- : BYTE_LITERAL
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-char_literal
- @init { Marker marker = mark(); }
- : CHAR_LITERAL
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-short_literal
- @init { Marker marker = mark(); }
- : SHORT_LITERAL
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-integer_literal
- @init { Marker marker = mark(); }
- : ( POSITIVE_INTEGER_LITERAL
- | NEGATIVE_INTEGER_LITERAL)
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-long_literal
- @init { Marker marker = mark(); }
- : LONG_LITERAL
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-float_literal
- @init { Marker marker = mark(); }
- : ( FLOAT_LITERAL_OR_ID
- | FLOAT_LITERAL )
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-double_literal
- @init { Marker marker = mark(); }
- : ( DOUBLE_LITERAL_OR_ID
- | DOUBLE_LITERAL)
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-string_literal
- @init { Marker marker = mark(); }
- : STRING_LITERAL
- { finishToken(marker, SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-array_literal
- @init { Marker marker = mark(); }
- : open_brace (literal (comma literal)* | ) close_brace
- { marker.done(SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-enum_literal
- @init { Marker marker = mark(); }
- : ENUM_DIRECTIVE fully_qualified_field
- { marker.done(SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-type_field_method_literal
- @init { Marker marker = mark(); }
- : ( type_descriptor
- | fully_qualified_field
- | fully_qualified_method)
- { marker.done(SmaliElementTypes.LITERAL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-subannotation
- @init {
- Marker marker = mark();
- Marker paramListMarker = null;
- }
- : SUBANNOTATION_DIRECTIVE class_descriptor
- { paramListMarker = mark(); }
- annotation_element*
- { paramListMarker.done(SmaliElementTypes.ANNOTATION_PARAMETER_LIST); }
- end_subannotation_directive
- { marker.done(SmaliElementTypes.ANNOTATION); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-end_subannotation_directive
- : END_SUBANNOTATION_DIRECTIVE;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-literal
- : long_literal
- | integer_literal
- | short_literal
- | byte_literal
- | float_literal
- | double_literal
- | char_literal
- | string_literal
- | bool_literal
- | null_literal
- | array_literal
- | subannotation
- | type_field_method_literal
- | enum_literal;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-string_or_null_literal
- : string_literal
- | null_literal;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-integral_literal
- : long_literal
- | integer_literal
- | short_literal
- | char_literal
- | byte_literal;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-fixed_32bit_literal
- : long_literal
- | integer_literal
- | short_literal
- | byte_literal
- | float_literal
- | char_literal
- | bool_literal;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-fixed_literal
- : integer_literal
- | long_literal
- | short_literal
- | byte_literal
- | float_literal
- | double_literal
- | char_literal
- | bool_literal;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-annotation_element
- @init {
- Marker marker = mark();
- Marker nameMarker = null;
- }
- : { nameMarker = mark(); } simple_name { nameMarker.done(SmaliElementTypes.ANNOTATION_ELEMENT_NAME); }
- equal literal
- { marker.done(SmaliElementTypes.ANNOTATION_ELEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-equal
- : EQUAL;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-annotation
- @init {
- Marker marker = mark();
- Marker paramListMarker = null;
- }
- : ANNOTATION_DIRECTIVE annotation_visibility class_descriptor
- { paramListMarker = mark(); }
- annotation_element*
- { paramListMarker.done(SmaliElementTypes.ANNOTATION_PARAMETER_LIST); }
- end_annotation_directive
- { marker.done(SmaliElementTypes.ANNOTATION); };
-
-annotation_visibility
- : ANNOTATION_VISIBILITY;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-end_annotation_directive
- : END_ANNOTATION_DIRECTIVE;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-arrow
- : ARROW;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-fully_qualified_method
- @init { Marker marker = mark(); }
- : reference_type_descriptor arrow member_name method_prototype_reference
- { marker.done(SmaliElementTypes.METHOD_REFERENCE); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-fully_qualified_field
- @init { Marker marker = mark(); }
- : reference_type_descriptor arrow member_name colon nonvoid_type_descriptor
- { marker.done(SmaliElementTypes.FIELD_REFERENCE); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-label
- @init { Marker marker = mark(); }
- : colon simple_name
- { marker.done(SmaliElementTypes.LABEL); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-label_ref
- @init { Marker marker = mark(); }
- : colon simple_name
- { marker.done(SmaliElementTypes.LABEL_REFERENCE); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-register_list
- : open_brace (register (comma register)*)? close_brace;
-
-register_range
- : open_brace (register (dotdot register)?)? close_brace;
-
-verification_error_reference
- : class_descriptor | fully_qualified_field | fully_qualified_method;
-
-catch_directive
- @init { Marker marker = mark(); }
- : CATCH_DIRECTIVE nonvoid_type_descriptor open_brace label_ref dotdot label_ref close_brace label_ref
- { marker.done(SmaliElementTypes.CATCH_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-catchall_directive
- @init { Marker marker = mark(); }
- : CATCHALL_DIRECTIVE open_brace label_ref dotdot label_ref close_brace label_ref
- { marker.done(SmaliElementTypes.CATCH_ALL_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-/*When there are annotations immediately after a parameter definition, we don't know whether they are parameter annotations
-or method annotations until we determine if there is an .end parameter directive. In either case, we still "consume" and parse
-the annotations. If it turns out that they are parameter annotations, we include them in the I_PARAMETER AST. Otherwise, we
-add them to the $statements_and_directives::methodAnnotations list*/
-parameter_directive
- @init {
- Marker marker = mark();
- Marker annotationsMarker = null;
- boolean gotEndParam = false;
- }
- : PARAMETER_DIRECTIVE register
- (comma local_name)?
- { annotationsMarker = mark(); } parameter_annotations
- ( end_parameter_directive { gotEndParam = true; } )?
- {
- if (gotEndParam) {
- annotationsMarker.drop();
- marker.done(SmaliElementTypes.PARAMETER_STATEMENT);
- } else {
- marker.doneBefore(SmaliElementTypes.PARAMETER_STATEMENT, annotationsMarker);
- annotationsMarker.drop();
- }
- };
- catch [RecognitionException re] {
- if (annotationsMarker != null) {
- annotationsMarker.drop();
- }
- recover(input, re);
- reportError(marker, re, false);
- }
-
-parameter_annotations
- : ((ANNOTATION_DIRECTIVE)=> annotation)*;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-end_parameter_directive
- : END_PARAMETER_DIRECTIVE;
-
-local_name
- @init {
- Marker localNameMarker = mark();
- Marker stringMarker = mark();
- }
- : STRING_LITERAL
- {
- finishToken(stringMarker, SmaliElementTypes.LITERAL);
- finishToken(localNameMarker, SmaliElementTypes.LOCAL_NAME);
- };
- catch [RecognitionException re] {
- stringMarker.drop();
- recover(input, re);
- reportError(localNameMarker, re, false);
- }
-
-register
- @init { Marker marker = mark(); }
- : REGISTER
- { finishToken(marker, SmaliElementTypes.REGISTER_REFERENCE); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-debug_directive
- : line_directive
- | local_directive
- | end_local_directive
- | restart_local_directive
- | prologue_directive
- | epilogue_directive
- | source_directive;
-
-line_directive
- @init { Marker marker = mark(); }
- : LINE_DIRECTIVE integral_literal
- { marker.done(SmaliElementTypes.LINE_DEBUG_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-local_directive
- @init { Marker marker = mark(); }
- : LOCAL_DIRECTIVE register (comma string_or_null_literal colon type_descriptor
- (comma string_literal)? )?
- { marker.done(SmaliElementTypes.LOCAL_DEBUG_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-end_local_directive
- @init { Marker marker = mark(); }
- : END_LOCAL_DIRECTIVE register
- { marker.done(SmaliElementTypes.END_LOCAL_DEBUG_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-restart_local_directive
- @init { Marker marker = mark(); }
- : RESTART_LOCAL_DIRECTIVE register
- { marker.done(SmaliElementTypes.RESTART_LOCAL_DEBUG_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-prologue_directive
- @init { Marker marker = mark(); }
- : PROLOGUE_DIRECTIVE
- { marker.done(SmaliElementTypes.PROLOGUE_DEBUG_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-epilogue_directive
- @init { Marker marker = mark(); }
- : EPILOGUE_DIRECTIVE
- { marker.done(SmaliElementTypes.EPILOGUE_DEBUG_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-source_directive
- @init { Marker marker = mark(); }
- : SOURCE_DIRECTIVE string_literal?
- { marker.done(SmaliElementTypes.SOURCE_DEBUG_STATEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-instruction_format12x
- : INSTRUCTION_FORMAT12x
- | INSTRUCTION_FORMAT12x_OR_ID;
-
-instruction_format22s
- : INSTRUCTION_FORMAT22s
- | INSTRUCTION_FORMAT22s_OR_ID;
-
-instruction_format31i
- : INSTRUCTION_FORMAT31i
- | INSTRUCTION_FORMAT31i_OR_ID;
-
-instruction
- @init { Marker marker = mark(); }
- : ( insn_format10t
- | insn_format10x
- | insn_format10x_odex
- | insn_format11n
- | insn_format11x
- | insn_format12x
- | insn_format20bc
- | insn_format20t
- | insn_format21c_field
- | insn_format21c_field_odex
- | insn_format21c_string
- | insn_format21c_type
- | insn_format21ih
- | insn_format21lh
- | insn_format21s
- | insn_format21t
- | insn_format22b
- | insn_format22c_field
- | insn_format22c_field_odex
- | insn_format22c_type
- | insn_format22cs_field
- | insn_format22s
- | insn_format22t
- | insn_format22x
- | insn_format23x
- | insn_format30t
- | insn_format31c
- | insn_format31i
- | insn_format31t
- | insn_format32x
- | insn_format35c_method
- | insn_format35c_type
- | insn_format35c_method_odex
- | insn_format35mi_method
- | insn_format35ms_method
- | insn_format3rc_method
- | insn_format3rc_method_odex
- | insn_format3rc_type
- | insn_format3rmi_method
- | insn_format3rms_method
- | insn_format51l
- | insn_array_data_directive
- | insn_packed_switch_directive
- | insn_sparse_switch_directive )
- { marker.done(SmaliElementTypes.INSTRUCTION); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-insn_format10t
- : //e.g. goto endloop:
- //e.g. goto +3
- INSTRUCTION_FORMAT10t label_ref;
-
-insn_format10x
- : //e.g. return-void
- INSTRUCTION_FORMAT10x;
-
-insn_format10x_odex
- : //e.g. return-void-barrier
- INSTRUCTION_FORMAT10x_ODEX;
-
-insn_format11n
- : //e.g. const/4 v0, 5
- INSTRUCTION_FORMAT11n register comma integral_literal;
-
-insn_format11x
- : //e.g. move-result-object v1
- INSTRUCTION_FORMAT11x register;
-
-insn_format12x
- : //e.g. move v1 v2
- instruction_format12x register comma register;
-
-insn_format20bc
- : //e.g. throw-verification-error generic-error, Lsome/class;
- INSTRUCTION_FORMAT20bc VERIFICATION_ERROR_TYPE comma verification_error_reference;
-
-insn_format20t
- : //e.g. goto/16 endloop:
- INSTRUCTION_FORMAT20t label_ref;
-
-insn_format21c_field
- : //e.g. sget-object v0, java/lang/System/out LJava/io/PrintStream;
- INSTRUCTION_FORMAT21c_FIELD register comma fully_qualified_field;
-
-insn_format21c_field_odex
- : //e.g. sget-object-volatile v0, java/lang/System/out LJava/io/PrintStream;
- INSTRUCTION_FORMAT21c_FIELD_ODEX register comma fully_qualified_field;
-
-insn_format21c_string
- : //e.g. const-string v1, "Hello World!"
- INSTRUCTION_FORMAT21c_STRING register comma string_literal;
-
-insn_format21c_type
- : //e.g. const-class v2, Lorg/jf/HelloWorld2/HelloWorld2;
- INSTRUCTION_FORMAT21c_TYPE register comma nonvoid_type_descriptor;
-
-insn_format21ih
- : //e.g. const/high16 v1, 1234
- INSTRUCTION_FORMAT21ih register comma fixed_32bit_literal;
-
-insn_format21lh
- : //e.g. const-wide/high16 v1, 1234
- INSTRUCTION_FORMAT21lh register comma fixed_32bit_literal;
-
-insn_format21s
- : //e.g. const/16 v1, 1234
- INSTRUCTION_FORMAT21s register comma integral_literal;
-
-insn_format21t
- : //e.g. if-eqz v0, endloop:
- INSTRUCTION_FORMAT21t register comma label_ref;
-
-insn_format22b
- : //e.g. add-int v0, v1, 123
- INSTRUCTION_FORMAT22b register comma register comma integral_literal;
-
-insn_format22c_field
- : //e.g. iput-object v1, v0 org/jf/HelloWorld2/HelloWorld2.helloWorld Ljava/lang/String;
- INSTRUCTION_FORMAT22c_FIELD register comma register comma fully_qualified_field;
-
-insn_format22c_field_odex
- : //e.g. iput-object-volatile v1, v0 org/jf/HelloWorld2/HelloWorld2.helloWorld Ljava/lang/String;
- INSTRUCTION_FORMAT22c_FIELD_ODEX register comma register comma fully_qualified_field;
-
-insn_format22c_type
- : //e.g. instance-of v0, v1, Ljava/lang/String;
- INSTRUCTION_FORMAT22c_TYPE register comma register comma nonvoid_type_descriptor;
-
-insn_format22cs_field
- : //e.g. iget-quick v0, v1, field@0xc
- INSTRUCTION_FORMAT22cs_FIELD register comma register comma FIELD_OFFSET;
-
-insn_format22s
- : //e.g. add-int/lit16 v0, v1, 12345
- instruction_format22s register comma register comma integral_literal;
-
-insn_format22t
- : //e.g. if-eq v0, v1, endloop:
- INSTRUCTION_FORMAT22t register comma register comma label_ref;
-
-insn_format22x
- : //e.g. move/from16 v1, v1234
- INSTRUCTION_FORMAT22x register comma register;
-
-insn_format23x
- : //e.g. add-int v1, v2, v3
- INSTRUCTION_FORMAT23x register comma register comma register;
-
-insn_format30t
- : //e.g. goto/32 endloop:
- INSTRUCTION_FORMAT30t label_ref;
-
-insn_format31c
- : //e.g. const-string/jumbo v1 "Hello World!"
- INSTRUCTION_FORMAT31c register comma string_literal;
-
-insn_format31i
- : //e.g. const v0, 123456
- instruction_format31i register comma fixed_32bit_literal;
-
-insn_format31t
- : //e.g. fill-array-data v0, ArrayData:
- INSTRUCTION_FORMAT31t register comma label_ref;
-
-insn_format32x
- : //e.g. move/16 v4567, v1234
- INSTRUCTION_FORMAT32x register comma register;
-
-insn_format35c_method
- : //e.g. invoke-virtual {v0,v1} java/io/PrintStream/print(Ljava/lang/Stream;)V
- (INSTRUCTION_FORMAT35c_METHOD | INSTRUCTION_FORMAT35c_METHOD_OR_METHOD_HANDLE_TYPE) register_list comma fully_qualified_method;
-
-insn_format35c_type
- : //e.g. filled-new-array {v0,v1}, I
- INSTRUCTION_FORMAT35c_TYPE register_list comma nonvoid_type_descriptor;
-
-insn_format35c_method_odex
- : //e.g. invoke-direct {p0}, Ljava/lang/Object;->()V
- INSTRUCTION_FORMAT35c_METHOD_ODEX register_list comma fully_qualified_method;
-
-insn_format35mi_method
- : //e.g. execute-inline {v0, v1}, inline@0x4
- INSTRUCTION_FORMAT35mi_METHOD register_list comma INLINE_INDEX;
-
-insn_format35ms_method
- : //e.g. invoke-virtual-quick {v0, v1}, vtable@0x4
- INSTRUCTION_FORMAT35ms_METHOD register_list comma VTABLE_INDEX;
-
-insn_format3rc_method
- : //e.g. invoke-virtual/range {v25..v26}, java/lang/StringBuilder/append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- INSTRUCTION_FORMAT3rc_METHOD register_range comma fully_qualified_method;
-
-insn_format3rc_method_odex
- : //e.g. invoke-object-init/range {p0}, Ljava/lang/Object;->()V
- INSTRUCTION_FORMAT3rc_METHOD_ODEX register_list comma fully_qualified_method;
-
-insn_format3rc_type
- : //e.g. filled-new-array/range {v0..v6}, I
- INSTRUCTION_FORMAT3rc_TYPE register_range comma nonvoid_type_descriptor;
-
-insn_format3rmi_method
- : //e.g. execute-inline/range {v0 .. v10}, inline@0x14
- INSTRUCTION_FORMAT3rmi_METHOD register_range comma INLINE_INDEX;
-
-insn_format3rms_method
- : //e.g. invoke-virtual-quick/range {v0 .. v10}, vtable@0x14
- INSTRUCTION_FORMAT3rms_METHOD register_range comma VTABLE_INDEX;
-
-insn_format51l
- : //e.g. const-wide v0, 5000000000L
- INSTRUCTION_FORMAT51l register comma fixed_literal;
-
-insn_array_data_directive
- : ARRAY_DATA_DIRECTIVE
- integer_literal
- array_data_element* end_array_data_directive;
-
-end_array_data_directive
- : END_ARRAY_DATA_DIRECTIVE;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-array_data_element
- @init { Marker marker = mark(); }
- : fixed_literal
- { marker.done(SmaliElementTypes.ARRAY_DATA_ELEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-insn_packed_switch_directive
- : PACKED_SWITCH_DIRECTIVE
- fixed_32bit_literal
- packed_switch_element*
- end_packed_switch_directive;
-
-end_packed_switch_directive
- : END_PACKED_SWITCH_DIRECTIVE;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-packed_switch_element
- @init { Marker marker = mark(); }
- : label_ref
- { marker.done(SmaliElementTypes.PACKED_SWITCH_ELEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
-
-insn_sparse_switch_directive
- : SPARSE_SWITCH_DIRECTIVE
- sparse_switch_element*
- end_sparse_switch_directive;
-
-end_sparse_switch_directive
- : END_SPARSE_SWITCH_DIRECTIVE;
- catch [RecognitionException re] {
- Marker errorMarker = mark();
- recover(input, re);
- reportError(errorMarker, re, false);
- }
-
-sparse_switch_element
- @init { Marker marker = mark(); }
- : fixed_32bit_literal arrow label_ref
- { marker.done(SmaliElementTypes.SPARSE_SWITCH_ELEMENT); };
- catch [RecognitionException re] {
- recover(input, re);
- reportError(marker, re, false);
- }
diff --git a/smalidea/src/main/java/org/jf/smalidea/PsiBuilderTokenStream.java b/smalidea/src/main/java/org/jf/smalidea/PsiBuilderTokenStream.java
deleted file mode 100644
index 00004001..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/PsiBuilderTokenStream.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.lang.PsiBuilder;
-import com.intellij.lang.PsiBuilder.Marker;
-import com.intellij.psi.TokenType;
-import com.intellij.psi.tree.IElementType;
-import org.antlr.runtime.CommonToken;
-import org.antlr.runtime.Token;
-import org.antlr.runtime.TokenSource;
-import org.antlr.runtime.TokenStream;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smali.InvalidToken;
-import org.jf.smali.smaliParser;
-
-import javax.annotation.Nonnull;
-import java.util.ArrayList;
-
-public class PsiBuilderTokenStream implements TokenStream {
- @Nonnull private PsiBuilder psiBuilder;
- @Nullable private CommonToken currentToken = null;
- @Nonnull private ArrayList markers = new ArrayList();
-
- public PsiBuilderTokenStream(@Nonnull PsiBuilder psiBuilder) {
- this.psiBuilder = psiBuilder;
- }
-
- @Override public Token LT(int k) {
- if (k == 1) {
- if (currentToken == null) {
- buildCurrentToken();
- }
- return currentToken;
- }
- throw new UnsupportedOperationException();
- }
-
- @Override public int range() {
- return currentToken==null?0:1;
- }
-
- @Override public Token get(int i) {
- throw new UnsupportedOperationException();
- }
-
- @Override public TokenSource getTokenSource() {
- throw new UnsupportedOperationException();
- }
-
- @Override public String toString(int start, int stop) {
- throw new UnsupportedOperationException();
- }
-
- @Override public String toString(Token start, Token stop) {
- throw new UnsupportedOperationException();
- }
-
- @Override public void consume() {
- psiBuilder.advanceLexer();
- buildCurrentToken();
- }
-
- private void buildCurrentToken() {
- IElementType element = psiBuilder.getTokenType();
- if (element != null) {
- if (element instanceof SmaliLexicalElementType) {
- SmaliLexicalElementType elementType = (SmaliLexicalElementType)element;
- currentToken = new CommonToken(elementType.tokenId, psiBuilder.getTokenText());
- } else if (element == TokenType.BAD_CHARACTER) {
- currentToken = new InvalidToken("", psiBuilder.getTokenText());
- } else {
- throw new UnsupportedOperationException();
- }
- } else {
- currentToken = new CommonToken(Token.EOF);
- }
- }
-
- @Override public int LA(int i) {
- IElementType elementType = psiBuilder.lookAhead(i-1);
- if (elementType == null) {
- return -1;
- } else if (elementType instanceof SmaliLexicalElementType) {
- return ((SmaliLexicalElementType)elementType).tokenId;
- } else if (elementType == TokenType.BAD_CHARACTER) {
- return smaliParser.INVALID_TOKEN;
- }
- throw new UnsupportedOperationException();
- }
-
- @Override public int mark() {
- int ret = markers.size();
- markers.add(psiBuilder.mark());
- return ret;
- }
-
- @Override public int index() {
- return psiBuilder.getCurrentOffset();
- }
-
- @Override public void rewind(int markerIndex) {
- PsiBuilder.Marker marker = markers.get(markerIndex);
- marker.rollbackTo();
- while (markerIndex < markers.size()) {
- markers.remove(markerIndex);
- }
- }
-
- @Override public void rewind() {
- rewind(markers.size()-1);
- mark();
- }
-
- @Override public void release(int markerIndex) {
- while (markerIndex < markers.size()) {
- markers.remove(markerIndex).drop();
- }
- }
-
- @Override public void seek(int index) {
- if (index < psiBuilder.getCurrentOffset()) {
- throw new UnsupportedOperationException();
- }
- while (index > psiBuilder.getCurrentOffset()) {
- consume();
- }
- }
-
- @Override public int size() {
- throw new UnsupportedOperationException();
- }
-
- @Override public String getSourceName() {
- return null;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliASTFactory.java b/smalidea/src/main/java/org/jf/smalidea/SmaliASTFactory.java
deleted file mode 100644
index 4e0208c2..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliASTFactory.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.jf.smalidea;
-
-import com.intellij.lang.ASTFactory;
-import com.intellij.psi.impl.source.tree.LeafElement;
-import com.intellij.psi.tree.IElementType;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.leaf.SmaliClassDescriptor;
-
-public class SmaliASTFactory extends ASTFactory {
-
- @Nullable
- @Override
- public LeafElement createLeaf(IElementType type, CharSequence text) {
- if (type == SmaliTokens.CLASS_DESCRIPTOR) {
- return new SmaliClassDescriptor(text);
- }
- return super.createLeaf(type, text);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliColorsPage.java b/smalidea/src/main/java/org/jf/smalidea/SmaliColorsPage.java
deleted file mode 100644
index b0ed5c04..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliColorsPage.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.openapi.editor.colors.TextAttributesKey;
-import com.intellij.openapi.fileTypes.SyntaxHighlighter;
-import com.intellij.openapi.options.colors.AttributesDescriptor;
-import com.intellij.openapi.options.colors.ColorDescriptor;
-import com.intellij.openapi.options.colors.ColorSettingsPage;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-import java.util.List;
-import java.util.Map;
-
-public class SmaliColorsPage implements ColorSettingsPage {
- private static final AttributesDescriptor[] ATTRS;
-
- static {
- List keys = SmaliHighlightingColors.getAllKeys();
-
- ATTRS = new AttributesDescriptor[keys.size()];
- for (int i=0; i()V\n" +
- " .registers 1\n" +
- " invoke-direct {p0}, Ljava/lang/Object;->()V\n" +
- " return-void\n" +
- ".end method\n" +
- "\n" +
- ".method public exampleMethod()V\n" +
- " .registers 10\n" +
- "\n" +
- " const v0, 1234\n" +
- " const-string v1, \"An Example String\"\n" +
- "\n" +
- " invoke-virtual {p0, v0, v1}, Lorg/jf/smalidea/ColorExample;->anotherMethod(ILjava/lang/String;)V\n" +
- "\n" +
- " move v2, v1\n" +
- " move v1, v0\n" +
- " move v0, p0\n" +
- "\n" +
- " invoke-virtual/range {v0 .. v2}, Lorg/jf/smalidea/ColorExample;->anotherMethod(ILjava/lang/String;)V\n" +
- "\n" +
- " return-void\n" +
- ".end method\n" +
- "\n" +
- ".method public anotherMethod(ILjava/Lang/String;)V\n" +
- " .registers 10\n" +
- "\n" +
- " # This is another example comment\n" +
- "\n" +
- " return-void\n" +
- ".end method\n" +
- "\n" +
- ".method public odexInstructions()V\n" +
- " .registers 10\n" +
- " invoke-virtual {p0}, vtable@0x1b\n" +
- "\n" +
- " iget-quick p0, field@0x1\n" +
- "\n" +
- " execute-inline {p0}, inline@0xa\n" +
- "\n" +
- " throw-verification-error illegal-method-access, Lblah;->Blort()V\n" +
- ".end method";
- }
-
- @NotNull @Override public AttributesDescriptor[] getAttributeDescriptors() {
- return ATTRS;
- }
-
- @Nullable @Override public Map getAdditionalHighlightingTagToDescriptorMap() {
- return null;
- }
-
- @NotNull @Override public ColorDescriptor[] getColorDescriptors() {
- return ColorDescriptor.EMPTY_ARRAY;
- }
-
- @NotNull @Override public String getDisplayName() {
- return "smali";
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliFileType.java b/smalidea/src/main/java/org/jf/smalidea/SmaliFileType.java
deleted file mode 100644
index e840bb8d..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliFileType.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.openapi.fileTypes.LanguageFileType;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-
-public class SmaliFileType extends LanguageFileType {
- public static final SmaliFileType INSTANCE = new SmaliFileType();
- public static final String DEFAULT_EXTENSION = "smali";
-
- private SmaliFileType() {
- super(SmaliLanguage.INSTANCE);
- }
-
- @NotNull @Override public String getName() {
- return "smali";
- }
-
- @NotNull @Override public String getDescription() {
- return "smali Files";
- }
-
- @NotNull @Override public String getDefaultExtension() {
- return DEFAULT_EXTENSION;
- }
-
- @Override public Icon getIcon() {
- return SmaliIcons.SmaliIcon;
- }
-
- @Override public boolean isJVMDebuggingSupported() {
- return true;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliFileTypeFactory.java b/smalidea/src/main/java/org/jf/smalidea/SmaliFileTypeFactory.java
deleted file mode 100644
index b5834c18..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliFileTypeFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.openapi.fileTypes.FileTypeConsumer;
-import com.intellij.openapi.fileTypes.FileTypeFactory;
-import org.jetbrains.annotations.NotNull;
-
-public class SmaliFileTypeFactory extends FileTypeFactory {
- @Override
- public void createFileTypes(@NotNull FileTypeConsumer consumer) {
- consumer.consume(SmaliFileType.INSTANCE, SmaliFileType.DEFAULT_EXTENSION);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliHighlighter.java b/smalidea/src/main/java/org/jf/smalidea/SmaliHighlighter.java
deleted file mode 100644
index 71e206a0..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliHighlighter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.lexer.Lexer;
-import com.intellij.openapi.editor.colors.TextAttributesKey;
-import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
-import com.intellij.psi.tree.IElementType;
-import org.jetbrains.annotations.NotNull;
-
-
-public class SmaliHighlighter extends SyntaxHighlighterBase {
- @NotNull @Override public Lexer getHighlightingLexer() {
- return new SmaliLexer();
- }
-
- @NotNull @Override public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
- if (tokenType instanceof SmaliLexicalElementType) {
- return ((SmaliLexicalElementType) tokenType).textAttributesKeys;
- }
- return new TextAttributesKey[] {};
- }
-
- // TODO: implement context sensitive highlighting. i.e. instance fields vs static fields, labels, etc. See: HighlightVisitorImpl
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliHighlightingColors.java b/smalidea/src/main/java/org/jf/smalidea/SmaliHighlightingColors.java
deleted file mode 100644
index eba5fd33..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliHighlightingColors.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.google.common.collect.Lists;
-import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
-import com.intellij.openapi.editor.colors.TextAttributesKey;
-
-import java.util.Collections;
-import java.util.List;
-
-public class SmaliHighlightingColors {
- private static final List allKeys = Lists.newArrayList();
-
- public static final TextAttributesKey ACCESS = createTextAttributesKey(
- "ACCESS", DefaultLanguageHighlighterColors.KEYWORD);
- public static final TextAttributesKey ARROW = createTextAttributesKey(
- "ARROW", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL);
- public static final TextAttributesKey BRACES = createTextAttributesKey(
- "BRACES", DefaultLanguageHighlighterColors.BRACES);
- public static final TextAttributesKey COLON = createTextAttributesKey(
- "COLON", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL);
- public static final TextAttributesKey COMMA = createTextAttributesKey(
- "COMMA", DefaultLanguageHighlighterColors.COMMA);
- public static final TextAttributesKey COMMENT = createTextAttributesKey(
- "COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
- public static final TextAttributesKey DIRECTIVE = createTextAttributesKey(
- "DIRECTIVE", DefaultLanguageHighlighterColors.KEYWORD);
- public static final TextAttributesKey DOTDOT = createTextAttributesKey(
- "DOTDOT", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL);
- public static final TextAttributesKey EQUAL = createTextAttributesKey(
- "EQUAL", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL);
- public static final TextAttributesKey IDENTIFIER = createTextAttributesKey(
- "IDENTIFIER", DefaultLanguageHighlighterColors.INSTANCE_METHOD);
- public static final TextAttributesKey INSTRUCTION = createTextAttributesKey(
- "INSTRUCTION", DefaultLanguageHighlighterColors.KEYWORD);
- public static final TextAttributesKey LITERAL = createTextAttributesKey(
- "LITERAL", DefaultLanguageHighlighterColors.NUMBER);
- public static final TextAttributesKey NUMBER = createTextAttributesKey(
- "NUMBER", DefaultLanguageHighlighterColors.NUMBER);
- public static final TextAttributesKey ODEX_REFERENCE = createTextAttributesKey(
- "ODEX_REFERENCE", DefaultLanguageHighlighterColors.INSTANCE_METHOD);
- public static final TextAttributesKey PARENS = createTextAttributesKey(
- "PARENS", DefaultLanguageHighlighterColors.PARENTHESES);
- public static final TextAttributesKey REGISTER = createTextAttributesKey(
- "REGISTER", DefaultLanguageHighlighterColors.LOCAL_VARIABLE);
- public static final TextAttributesKey STRING = createTextAttributesKey(
- "STRING", DefaultLanguageHighlighterColors.STRING);
- public static final TextAttributesKey TYPE = createTextAttributesKey(
- "TYPE", DefaultLanguageHighlighterColors.CLASS_REFERENCE);
- public static final TextAttributesKey VERIFICATION_ERROR_TYPE = createTextAttributesKey(
- "VERIFICATION_ERROR_TYPE", DefaultLanguageHighlighterColors.KEYWORD);
-
- private static TextAttributesKey createTextAttributesKey(String name, TextAttributesKey defaultColor) {
- TextAttributesKey key = TextAttributesKey.createTextAttributesKey(name, defaultColor);
- allKeys.add(key);
- return key;
- }
-
- public static List getAllKeys() {
- return Collections.unmodifiableList(allKeys);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliIcons.java b/smalidea/src/main/java/org/jf/smalidea/SmaliIcons.java
deleted file mode 100644
index 449e71b5..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliIcons.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.openapi.util.IconLoader;
-
-import javax.swing.*;
-
-public class SmaliIcons {
- public static final Icon SmaliIcon = IconLoader.getIcon("/icons/smali.png");
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliLanguage.java b/smalidea/src/main/java/org/jf/smalidea/SmaliLanguage.java
deleted file mode 100644
index f437ec27..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliLanguage.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.lang.Language;
-
-public class SmaliLanguage extends Language {
- public static final SmaliLanguage INSTANCE = new SmaliLanguage();
-
- private SmaliLanguage() {
- super("smali", "text/smali");
- }
-
- @Override public boolean isCaseSensitive() {
- return true;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliLexer.java b/smalidea/src/main/java/org/jf/smalidea/SmaliLexer.java
deleted file mode 100644
index 515749fa..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliLexer.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.lexer.LexerBase;
-import com.intellij.psi.TokenType;
-import com.intellij.psi.tree.IElementType;
-import org.antlr.runtime.CommonToken;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smali.smaliFlexLexer;
-import org.jf.smali.smaliParser;
-import org.jf.smali.util.BlankReader;
-
-public class SmaliLexer extends LexerBase {
- private final smaliFlexLexer lexer = new smaliFlexLexer(BlankReader.INSTANCE);
- private CommonToken token = null;
- private int state = 0;
- private int endOffset;
- private CharSequence text;
-
- public SmaliLexer() {
- super();
- lexer.setSuppressErrors(true);
- }
-
- @Override public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
- text = buffer;
- lexer.reset(buffer, startOffset, endOffset, initialState);
- this.endOffset = endOffset;
- this.token = null;
- this.state = 0;
- }
-
- @NotNull @Override public CharSequence getTokenSequence() {
- return getTokenText();
- }
-
- @NotNull @Override public String getTokenText() {
- ensureToken();
- return token.getText();
- }
-
- @Override
- public int getState() {
- ensureToken();
- return state;
- }
-
- @Override
- public IElementType getTokenType() {
- ensureToken();
- return mapTokenTypeToElementType(token.getType());
- }
-
- private IElementType mapTokenTypeToElementType(int tokenType) {
- if (tokenType == smaliParser.WHITE_SPACE) {
- return TokenType.WHITE_SPACE;
- }
- if (tokenType == smaliParser.INVALID_TOKEN) {
- return TokenType.BAD_CHARACTER;
- }
- if (tokenType == smaliParser.EOF) {
- return null;
- }
- return SmaliTokens.getElementType(tokenType);
- }
-
- @Override
- public int getTokenStart() {
- ensureToken();
- return token.getStartIndex();
- }
-
- @Override
- public int getTokenEnd() {
- ensureToken();
- return token.getStopIndex()+1;
- }
-
- @Override
- public void advance() {
- token = null;
- state = 0;
- }
-
- @NotNull @Override public CharSequence getBufferSequence() {
- return text;
- }
-
- @Override
- public int getBufferEnd() {
- return endOffset;
- }
-
- private void ensureToken() {
- if (token == null) {
- token = (CommonToken)lexer.nextToken();
- state = lexer.yystate();
- }
- assert token != null;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliLexicalElementType.java b/smalidea/src/main/java/org/jf/smalidea/SmaliLexicalElementType.java
deleted file mode 100644
index 5103dd9e..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliLexicalElementType.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.openapi.editor.colors.TextAttributesKey;
-import com.intellij.psi.tree.IElementType;
-
-public class SmaliLexicalElementType extends IElementType {
- public final int tokenId;
- public final TextAttributesKey[] textAttributesKeys;
-
- protected SmaliLexicalElementType(int tokenId, String tokenName, TextAttributesKey textAttributesKey) {
- super(tokenName, SmaliLanguage.INSTANCE);
- this.tokenId = tokenId;
- this.textAttributesKeys = new TextAttributesKey[] {textAttributesKey};
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliParser.java b/smalidea/src/main/java/org/jf/smalidea/SmaliParser.java
deleted file mode 100644
index ed0fb19a..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliParser.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-
-import com.intellij.lang.ASTNode;
-import com.intellij.lang.PsiBuilder;
-import com.intellij.lang.PsiParser;
-import com.intellij.psi.tree.IElementType;
-import org.antlr.runtime.RecognitionException;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliParser implements PsiParser {
- @NotNull @Override public ASTNode parse(IElementType root, PsiBuilder builder) {
- builder.setDebugMode(true);
-
- PsiBuilder.Marker rootMarker = builder.mark();
- PsiBuilder.Marker classMarker = builder.mark();
-
- PsiBuilderTokenStream tokenStream = new PsiBuilderTokenStream(builder);
- smalideaParser parser = new smalideaParser(tokenStream);
- parser.setPsiBuilder(builder);
- try {
- parser.smali_file();
- } catch (RecognitionException ex) {
- // TODO: how to handle this?
- ex.printStackTrace();
- }
-
- classMarker.done(SmaliElementTypes.CLASS);
- rootMarker.done(root);
- return builder.getTreeBuilt();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliParserDefinition.java b/smalidea/src/main/java/org/jf/smalidea/SmaliParserDefinition.java
deleted file mode 100644
index 77f1623a..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliParserDefinition.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.intellij.lang.ASTNode;
-import com.intellij.lang.LanguageUtil;
-import com.intellij.lang.ParserDefinition;
-import com.intellij.lang.PsiParser;
-import com.intellij.lexer.Lexer;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.FileViewProvider;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.TokenType;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.tree.IFileElementType;
-import com.intellij.psi.tree.TokenSet;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.psi.SmaliElementTypes;
-import org.jf.smalidea.psi.impl.SmaliFile;
-import org.jf.smalidea.psi.stub.element.SmaliStubElementType;
-
-public class SmaliParserDefinition implements ParserDefinition {
- @NotNull @Override public Lexer createLexer(Project project) {
- return new SmaliLexer();
- }
-
- @Override public PsiParser createParser(Project project) {
- return new SmaliParser();
- }
-
- @Override public IFileElementType getFileNodeType() {
- return SmaliElementTypes.FILE;
- }
-
- private static final TokenSet WHITESPACE = TokenSet.create(TokenType.WHITE_SPACE);
- @NotNull @Override public TokenSet getWhitespaceTokens() {
- return WHITESPACE;
- }
-
- private static final TokenSet COMMENT = TokenSet.create(SmaliTokens.LINE_COMMENT);
- @NotNull @Override public TokenSet getCommentTokens() {
- return COMMENT;
- }
-
- private static final TokenSet STRING_LITERAL = TokenSet.create(SmaliTokens.STRING_LITERAL);
- @NotNull @Override public TokenSet getStringLiteralElements() {
- return STRING_LITERAL;
- }
-
- @NotNull @Override public PsiElement createElement(ASTNode node) {
- IElementType elementType = node.getElementType();
- if (elementType instanceof SmaliStubElementType) {
- return ((SmaliStubElementType)elementType).createPsi(node);
- }
- throw new RuntimeException("Unexpected element type");
- }
-
- @Override public PsiFile createFile(FileViewProvider viewProvider) {
- return new SmaliFile(viewProvider);
- }
-
- @Override public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) {
- return LanguageUtil.canStickTokensTogetherByLexer(left, right, new SmaliLexer());
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/SmaliTokens.java b/smalidea/src/main/java/org/jf/smalidea/SmaliTokens.java
deleted file mode 100644
index 248c5bdb..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/SmaliTokens.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea;
-
-import com.google.common.collect.Maps;
-import com.intellij.openapi.editor.colors.TextAttributesKey;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.tree.TokenSet;
-import org.jf.smali.smaliParser;
-
-import java.lang.reflect.Field;
-import java.util.Map;
-
-public class SmaliTokens {
- private static final IElementType[] ELEMENT_TYPES;
-
- public static IElementType getElementType(int tokenType) {
- return ELEMENT_TYPES[tokenType];
- }
-
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType ACCESS_SPEC;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType ANNOTATION_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType ANNOTATION_VISIBILITY;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType ARRAY_DATA_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType ARRAY_TYPE_PREFIX;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType ARROW;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType BOOL_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType BYTE_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType CATCH_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType CATCHALL_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType CHAR_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType CLASS_DESCRIPTOR;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType CLASS_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType CLOSE_BRACE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType CLOSE_PAREN;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType COLON;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType COMMA;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType DOTDOT;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType DOUBLE_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType DOUBLE_LITERAL_OR_ID;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType END_ANNOTATION_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType END_ARRAY_DATA_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType END_FIELD_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType END_LOCAL_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType END_METHOD_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType END_PACKED_SWITCH_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType END_PARAMETER_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType END_SPARSE_SWITCH_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType END_SUBANNOTATION_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType ENUM_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType EPILOGUE_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType EQUAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType FIELD_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType FIELD_OFFSET;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType FLOAT_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType FLOAT_LITERAL_OR_ID;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType IMPLEMENTS_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INLINE_INDEX;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT10t;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT10x;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT10x_ODEX;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT11n;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT11x;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT12x;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT12x_OR_ID;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT20bc;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT20t;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT21c_FIELD;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT21c_FIELD_ODEX;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT21c_STRING;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT21c_TYPE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT21ih;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT21lh;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT21s;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT21t;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT22b;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT22c_FIELD;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT22c_FIELD_ODEX;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT22c_TYPE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT22cs_FIELD;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT22s;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT22s_OR_ID;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT22t;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT22x;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT23x;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT30t;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT31c;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT31i;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT31i_OR_ID;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT31t;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT32x;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT35c_METHOD;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT35c_METHOD_ODEX;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT35c_METHOD_OR_METHOD_HANDLE_TYPE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT35c_TYPE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT35mi_METHOD;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT35ms_METHOD;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT3rc_METHOD;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT3rc_METHOD_ODEX;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT3rc_TYPE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT3rmi_METHOD;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT3rms_METHOD;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType INSTRUCTION_FORMAT51l;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType LINE_COMMENT;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType LINE_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType LOCAL_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType LOCALS_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType LONG_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType METHOD_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType MEMBER_NAME;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType NEGATIVE_INTEGER_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType NULL_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType OPEN_BRACE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType OPEN_PAREN;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType PACKED_SWITCH_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType PARAM_LIST_OR_ID_PRIMITIVE_TYPE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType PARAMETER_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType POSITIVE_INTEGER_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType PRIMITIVE_TYPE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType PROLOGUE_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType REGISTER;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType REGISTERS_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType RESTART_LOCAL_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType SHORT_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType SIMPLE_NAME;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType SOURCE_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType SPARSE_SWITCH_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType STRING_LITERAL;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType SUBANNOTATION_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType SUPER_DIRECTIVE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType VERIFICATION_ERROR_TYPE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType VOID_TYPE;
- @SuppressWarnings({"UnusedDeclaration"}) public static IElementType VTABLE_INDEX;
-
- public static final TokenSet INSTRUCTION_TOKENS;
-
- static {
- Map tokenColors = Maps.newHashMap();
-
- tokenColors.put("ACCESS_SPEC", SmaliHighlightingColors.ACCESS);
- tokenColors.put("ANNOTATION_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("ANNOTATION_VISIBILITY", SmaliHighlightingColors.ACCESS);
- tokenColors.put("ARRAY_DATA_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("ARRAY_TYPE_PREFIX", SmaliHighlightingColors.TYPE);
- tokenColors.put("ARROW", SmaliHighlightingColors.ARROW);
- tokenColors.put("BOOL_LITERAL", SmaliHighlightingColors.LITERAL);
- tokenColors.put("BYTE_LITERAL", SmaliHighlightingColors.NUMBER);
- tokenColors.put("CATCH_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("CATCHALL_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("CHAR_LITERAL", SmaliHighlightingColors.STRING);
- tokenColors.put("CLASS_DESCRIPTOR", SmaliHighlightingColors.TYPE);
- tokenColors.put("CLASS_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("CLOSE_BRACE", SmaliHighlightingColors.BRACES);
- tokenColors.put("CLOSE_PAREN", SmaliHighlightingColors.PARENS);
- tokenColors.put("COLON", SmaliHighlightingColors.COLON);
- tokenColors.put("COMMA", SmaliHighlightingColors.COMMA);
- tokenColors.put("DOTDOT", SmaliHighlightingColors.DOTDOT);
- tokenColors.put("DOUBLE_LITERAL", SmaliHighlightingColors.NUMBER);
- tokenColors.put("DOUBLE_LITERAL_OR_ID", SmaliHighlightingColors.NUMBER);
- tokenColors.put("END_ANNOTATION_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("END_ARRAY_DATA_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("END_FIELD_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("END_LOCAL_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("END_METHOD_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("END_PACKED_SWITCH_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("END_PARAMETER_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("END_SPARSE_SWITCH_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("END_SUBANNOTATION_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("ENUM_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("EPILOGUE_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("EQUAL", SmaliHighlightingColors.EQUAL);
- tokenColors.put("FIELD_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("FIELD_OFFSET", SmaliHighlightingColors.ODEX_REFERENCE);
- tokenColors.put("FLOAT_LITERAL", SmaliHighlightingColors.NUMBER);
- tokenColors.put("FLOAT_LITERAL_OR_ID", SmaliHighlightingColors.NUMBER);
- tokenColors.put("IMPLEMENTS_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("INLINE_INDEX", SmaliHighlightingColors.ODEX_REFERENCE);
- tokenColors.put("INSTRUCTION_FORMAT10t", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT10x", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT10x_ODEX", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT11n", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT11x", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT12x", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT12x_OR_ID", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT20bc", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT20t", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT21c_FIELD", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT21c_FIELD_ODEX", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT21c_STRING", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT21c_TYPE", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT21ih", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT21lh", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT21s", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT21t", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT22b", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT22c_FIELD", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT22c_FIELD_ODEX", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT22c_TYPE", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT22cs_FIELD", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT22s", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT22s_OR_ID", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT22t", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT22x", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT23x", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT30t", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT31c", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT31i", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT31i_OR_ID", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT31t", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT32x", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT35c_METHOD", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT35c_METHOD_ODEX", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT35c_METHOD_OR_METHOD_HANDLE_TYPE", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT35c_TYPE", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT35mi_METHOD", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT35ms_METHOD", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT3rc_METHOD", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT3rc_METHOD_ODEX", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT3rc_TYPE", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT3rmi_METHOD", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT3rms_METHOD", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("INSTRUCTION_FORMAT51l", SmaliHighlightingColors.INSTRUCTION);
- tokenColors.put("LINE_COMMENT", SmaliHighlightingColors.COMMENT);
- tokenColors.put("LINE_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("LOCAL_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("LOCALS_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("LONG_LITERAL", SmaliHighlightingColors.NUMBER);
- tokenColors.put("MEMBER_NAME", SmaliHighlightingColors.IDENTIFIER);
- tokenColors.put("METHOD_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("NEGATIVE_INTEGER_LITERAL", SmaliHighlightingColors.NUMBER);
- tokenColors.put("NULL_LITERAL", SmaliHighlightingColors.LITERAL);
- tokenColors.put("OPEN_BRACE", SmaliHighlightingColors.BRACES);
- tokenColors.put("OPEN_PAREN", SmaliHighlightingColors.PARENS);
- tokenColors.put("PACKED_SWITCH_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("PARAM_LIST_OR_ID_PRIMITIVE_TYPE", SmaliHighlightingColors.TYPE);
- tokenColors.put("PARAMETER_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("POSITIVE_INTEGER_LITERAL", SmaliHighlightingColors.NUMBER);
- tokenColors.put("PRIMITIVE_TYPE", SmaliHighlightingColors.TYPE);
- tokenColors.put("PROLOGUE_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("REGISTER", SmaliHighlightingColors.REGISTER);
- tokenColors.put("REGISTERS_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("RESTART_LOCAL_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("SHORT_LITERAL", SmaliHighlightingColors.NUMBER);
- tokenColors.put("SIMPLE_NAME", SmaliHighlightingColors.IDENTIFIER);
- tokenColors.put("SOURCE_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("SPARSE_SWITCH_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("STRING_LITERAL", SmaliHighlightingColors.STRING);
- tokenColors.put("SUBANNOTATION_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("SUPER_DIRECTIVE", SmaliHighlightingColors.DIRECTIVE);
- tokenColors.put("VERIFICATION_ERROR_TYPE", SmaliHighlightingColors.VERIFICATION_ERROR_TYPE);
- tokenColors.put("VOID_TYPE", SmaliHighlightingColors.TYPE);
- tokenColors.put("VTABLE_INDEX", SmaliHighlightingColors.ODEX_REFERENCE);
-
- int tokenCount = smaliParser.tokenNames.length;
- ELEMENT_TYPES = new IElementType[tokenCount];
-
- for (int tokenId=0; tokenId> SMALI_LAZY_VALUES_KEY = Key.create("_smali_register_value_key_");
-
- @Override
- public JavaCodeFragment createCodeFragment(TextWithImports item, PsiElement context, Project project) {
- context = wrapContext(project, context);
- JavaCodeFragment fragment = super.createCodeFragment(item, context, project);
- List lazyValues = context.getUserData(SMALI_LAZY_VALUES_KEY);
- if (lazyValues != null) {
- fragment.putUserData(SMALI_LAZY_VALUES_KEY, lazyValues);
- }
- return fragment;
- }
-
- @Override
- public boolean isContextAccepted(PsiElement contextElement) {
- if (contextElement == null) {
- return false;
- }
- return contextElement.getLanguage() == SmaliLanguage.INSTANCE;
- }
-
- @Override
- public JavaCodeFragment createPresentationCodeFragment(TextWithImports item, PsiElement context, Project project) {
- context = wrapContext(project, context);
- JavaCodeFragment fragment = super.createPresentationCodeFragment(item, context, project);
- List lazyValues = context.getUserData(SMALI_LAZY_VALUES_KEY);
- if (lazyValues != null) {
- fragment.putUserData(SMALI_LAZY_VALUES_KEY, lazyValues);
- }
- return fragment;
- }
-
- @Override public LanguageFileType getFileType() {
- return SmaliFileType.INSTANCE;
- }
-
- @Override public EvaluatorBuilder getEvaluatorBuilder() {
- final EvaluatorBuilder builder = super.getEvaluatorBuilder();
- return new EvaluatorBuilder() {
-
- @Override
- public ExpressionEvaluator build(PsiElement codeFragment, SourcePosition position)
- throws EvaluateException {
- return new SmaliExpressionEvaluator(codeFragment, builder.build(codeFragment, position));
- }
- };
- }
-
- private PsiElement wrapContext(final Project project, final PsiElement originalContext) {
- if (project.isDefault()) return originalContext;
-
- final List lazyValues = Lists.newArrayList();
-
- SmaliInstruction currentInstruction = (SmaliInstruction)PsiUtil.searchBackward(originalContext,
- PsiMatchers.hasClass(SmaliInstruction.class),
- PsiMatchers.hasClass(SmaliMethod.class));
-
- if (currentInstruction == null) {
- currentInstruction = (SmaliInstruction)PsiUtil.searchForward(originalContext,
- PsiMatchers.hasClass(SmaliInstruction.class),
- PsiMatchers.hasClass(SmaliMethod.class));
- if (currentInstruction == null) {
- return originalContext;
- }
- }
-
- final SmaliMethod containingMethod = currentInstruction.getParentMethod();
- AnalyzedInstruction analyzedInstruction = currentInstruction.getAnalyzedInstruction();
- if (analyzedInstruction == null) {
- return originalContext;
- }
-
- final int firstParameterRegister = containingMethod.getRegisterCount() -
- containingMethod.getParameterRegisterCount();
-
- final Map registerMap = Maps.newHashMap();
- StringBuilder variablesText = new StringBuilder();
- for (int i=0; i= 0) {
- variablesText.append("int p").append(parameterRegisterNumber).append(";\n");
- registerMap.put("p" + parameterRegisterNumber, "I");
- }
- break;
- case RegisterType.BOOLEAN:
- variablesText.append("boolean v").append(i).append(";\n");
- registerMap.put("v" + i, "Z");
- if (parameterRegisterNumber >= 0) {
- variablesText.append("boolean p").append(parameterRegisterNumber).append(";\n");
- registerMap.put("p" + parameterRegisterNumber, "Z");
- }
- break;
- case RegisterType.BYTE:
- case RegisterType.POS_BYTE:
- variablesText.append("byte v").append(i).append(";\n");
- registerMap.put("v" + i, "B");
- if (parameterRegisterNumber >= 0) {
- variablesText.append("byte p").append(parameterRegisterNumber).append(";\n");
- registerMap.put("p" + parameterRegisterNumber, "B");
- }
- break;
- case RegisterType.SHORT:
- case RegisterType.POS_SHORT:
- variablesText.append("short v").append(i).append(";\n");
- registerMap.put("v" + i, "S");
- if (parameterRegisterNumber >= 0) {
- variablesText.append("short p").append(parameterRegisterNumber).append(";\n");
- registerMap.put("p" + parameterRegisterNumber, "S");
- }
- break;
- case RegisterType.CHAR:
- variablesText.append("char v").append(i).append(";\n");
- registerMap.put("v" + i, "C");
- if (parameterRegisterNumber >= 0) {
- variablesText.append("char p").append(parameterRegisterNumber).append(";\n");
- registerMap.put("p" + parameterRegisterNumber, "C");
- }
- break;
- case RegisterType.FLOAT:
- variablesText.append("float v").append(i).append(";\n");
- registerMap.put("v" + i, "F");
- if (parameterRegisterNumber >= 0) {
- variablesText.append("float p").append(parameterRegisterNumber).append(";\n");
- registerMap.put("p" + parameterRegisterNumber, "F");
- }
- break;
- case RegisterType.LONG_LO:
- variablesText.append("long v").append(i).append(";\n");
- registerMap.put("v" + i, "J");
- if (parameterRegisterNumber >= 0) {
- variablesText.append("long p").append(parameterRegisterNumber).append(";\n");
- registerMap.put("p" + parameterRegisterNumber, "J");
- }
- break;
- case RegisterType.DOUBLE_LO:
- variablesText.append("double v").append(i).append(";\n");
- registerMap.put("v" + i, "D");
- if (parameterRegisterNumber >= 0) {
- variablesText.append("double p").append(parameterRegisterNumber).append(";\n");
- registerMap.put("p" + parameterRegisterNumber, "D");
- }
- break;
- case RegisterType.UNINIT_REF:
- case RegisterType.UNINIT_THIS:
- case RegisterType.REFERENCE:
- String smaliType = registerType.type.getType();
- String javaType = NameUtils.smaliToJavaType(smaliType);
- variablesText.append(javaType).append(" v").append(i).append(";\n");
- registerMap.put("v" + i, smaliType);
- if (parameterRegisterNumber >= 0) {
- variablesText.append(javaType).append(" p").append(parameterRegisterNumber).append(";\n");
- registerMap.put("p" + parameterRegisterNumber, "Ljava/lang/Object;");
- }
- break;
- }
- }
- final TextWithImportsImpl textWithImports = new TextWithImportsImpl(CodeFragmentKind.CODE_BLOCK,
- variablesText.toString(), "", getFileType());
-
- final JavaCodeFragment codeFragment = super.createCodeFragment(textWithImports, originalContext, project);
-
- codeFragment.accept(new JavaRecursiveElementVisitor() {
- @Override
- public void visitLocalVariable(final PsiLocalVariable variable) {
- final String name = variable.getName();
- if (name != null && registerMap.containsKey(name)) {
- int registerNumber = Integer.parseInt(name.substring(1));
- if (name.charAt(0) == 'p') {
- registerNumber += ApplicationManager.getApplication().runReadAction(new Computable() {
- @Override public Integer compute() {
- return containingMethod.getRegisterCount() -
- containingMethod.getParameterRegisterCount();
- }
- });
- }
- LazyValue lazyValue = LazyValue.create(containingMethod, project, registerNumber,
- registerMap.get(name));
- variable.putUserData(CodeFragmentFactoryContextWrapper.LABEL_VARIABLE_VALUE_KEY, lazyValue);
- lazyValues.add(lazyValue);
- }
- }
- });
-
- int offset = variablesText.length() - 1;
-
- final PsiElement newContext = codeFragment.findElementAt(offset);
- if (newContext != null) {
- newContext.putUserData(SMALI_LAZY_VALUES_KEY, lazyValues);
- return newContext;
- }
- return originalContext;
- }
-
- @Nullable
- public static Value evaluateRegister(EvaluationContext context, final SmaliMethod smaliMethod,
- final int registerNum, final String type) throws EvaluateException {
-
- if (registerNum >= smaliMethod.getRegisterCount()) {
- return null;
- }
-
- final StackFrameProxy frameProxy = context.getSuspendContext().getFrameProxy();
- if (frameProxy == null) {
- return null;
- }
-
- VirtualMachine vm = frameProxy.getStackFrame().virtualMachine();
- Location currentLocation = frameProxy.location();
- if (currentLocation == null) {
- return null;
- }
-
- Method method = currentLocation.method();
-
- try {
- final Constructor localVariableConstructor = LocalVariableImpl.class.getDeclaredConstructor(
- VirtualMachine.class, Method.class, Integer.TYPE, Location.class, Location.class, String.class,
- String.class, String.class);
- localVariableConstructor.setAccessible(true);
-
- Constructor locationConstructor = LocationImpl.class.getDeclaredConstructor(
- VirtualMachine.class, Method.class, Long.TYPE);
- locationConstructor.setAccessible(true);
-
- int methodSize = 0;
- for (SmaliInstruction instruction: smaliMethod.getInstructions()) {
- methodSize += instruction.getInstructionSize();
- }
- Location endLocation = null;
- for (int endCodeIndex = (methodSize/2) - 1; endCodeIndex >= 0; endCodeIndex--) {
- endLocation = method.locationOfCodeIndex(endCodeIndex);
- if (endLocation != null) {
- break;
- }
- }
- if (endLocation == null) {
- return null;
- }
-
- LocalVariable localVariable = localVariableConstructor.newInstance(vm,
- method,
- mapRegister(frameProxy.getStackFrame().virtualMachine(), smaliMethod, registerNum),
- method.location(),
- endLocation,
- String.format("v%d", registerNum), type, null);
-
- return frameProxy.getStackFrame().getValue(localVariable);
- } catch (NoSuchMethodException e) {
- return null;
- } catch (InstantiationException e) {
- return null;
- } catch (IllegalAccessException e) {
- return null;
- } catch (InvocationTargetException e) {
- return null;
- }
- }
-
- private static int mapRegister(final VirtualMachine vm, final SmaliMethod smaliMethod, final int register) {
- if (vm.version().equals("1.5.0")) {
- return mapRegisterForDalvik(smaliMethod, register);
- } else {
- return mapRegisterForArt(smaliMethod, register);
- }
- }
-
- private static int mapRegisterForArt(final SmaliMethod smaliMethod, final int register) {
- return ApplicationManager.getApplication().runReadAction(new Computable() {
- @Override public Integer compute() {
-
- int totalRegisters = smaliMethod.getRegisterCount();
- int parameterRegisters = smaliMethod.getParameterRegisterCount();
-
- if (smaliMethod.getModifierList().hasModifierProperty("static")) {
- return register;
- }
-
- // For ART, the parameter registers are rotated to the front
- if (register >= (totalRegisters - parameterRegisters)) {
- return register - (totalRegisters - parameterRegisters);
- }
- return register + parameterRegisters;
- }
- });
- }
-
- private static int mapRegisterForDalvik(final SmaliMethod smaliMethod, final int register) {
- return ApplicationManager.getApplication().runReadAction(new Computable() {
- @Override public Integer compute() {
- if (smaliMethod.getModifierList().hasModifierProperty("static")) {
- return register;
- }
-
- int totalRegisters = smaliMethod.getRegisterCount();
- int parameterRegisters = smaliMethod.getParameterRegisterCount();
-
- // For dalvik, p0 is mapped to register 1, and register 0 is mapped to register 1000
- if (register == (totalRegisters - parameterRegisters)) {
- return 0;
- }
- if (register == 0) {
- return 1000;
- }
- return register;
- }
- });
- }
-}
-
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliExpressionEvaluator.java b/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliExpressionEvaluator.java
deleted file mode 100644
index 89bba297..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliExpressionEvaluator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging;
-
-import com.intellij.debugger.engine.evaluation.EvaluateException;
-import com.intellij.debugger.engine.evaluation.EvaluationContext;
-import com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluator;
-import com.intellij.debugger.engine.evaluation.expression.Modifier;
-import com.intellij.psi.PsiElement;
-import com.sun.jdi.Value;
-import org.jf.smalidea.debugging.value.LazyValue;
-
-import java.util.List;
-
-public class SmaliExpressionEvaluator implements ExpressionEvaluator {
- private final PsiElement fragment;
- private final ExpressionEvaluator evaluator;
-
- public SmaliExpressionEvaluator(PsiElement fragment, ExpressionEvaluator evaluator) {
- this.fragment = fragment;
- this.evaluator = evaluator;
- }
-
- @Override public Value evaluate(EvaluationContext context) throws EvaluateException {
- List lazyValues = fragment.getUserData(SmaliCodeFragmentFactory.SMALI_LAZY_VALUES_KEY);
- if (lazyValues != null) {
- for (LazyValue lazyValue: lazyValues) {
- lazyValue.setEvaluationContext(context);
- }
- }
- return evaluator.evaluate(context);
- }
-
- @Override public Value getValue() {
- return evaluator.getValue();
- }
-
- @Override public Modifier getModifier() {
- return evaluator.getModifier();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliPositionManager.java b/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliPositionManager.java
deleted file mode 100644
index 9c0abbe6..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliPositionManager.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging;
-
-import com.intellij.debugger.NoDataException;
-import com.intellij.debugger.PositionManager;
-import com.intellij.debugger.SourcePosition;
-import com.intellij.debugger.engine.DebugProcess;
-import com.intellij.debugger.requests.ClassPrepareRequestor;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.sun.jdi.Location;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.request.ClassPrepareRequest;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.impl.SmaliClass;
-import org.jf.smalidea.psi.impl.SmaliFile;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-import org.jf.smalidea.psi.index.SmaliClassNameIndex;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-public class SmaliPositionManager implements PositionManager {
- private final DebugProcess debugProcess;
-
- public SmaliPositionManager(DebugProcess debugProcess) {
- this.debugProcess = debugProcess;
- }
-
- public SourcePosition getSourcePosition(final String declaringType, String methodName, String methodSignature,
- int codeIndex) throws NoDataException {
-
- Collection classes = ApplicationManager.getApplication().runReadAction(
- new Computable>() {
- @Override public Collection compute() {
- return SmaliClassNameIndex.INSTANCE.get(declaringType, debugProcess.getProject(),
- GlobalSearchScope.projectScope(debugProcess.getProject()));
- }
- });
-
- if (classes.size() > 0) {
- SmaliClass smaliClass = classes.iterator().next();
-
- // TODO: make an index for this?
- for (SmaliMethod smaliMethod: smaliClass.getMethods()) {
- if (smaliMethod.getName().equals(methodName) &&
- smaliMethod.getMethodPrototype().getText().equals(methodSignature)) {
- return smaliMethod.getSourcePositionForCodeOffset(codeIndex * 2);
- }
- }
- }
-
- throw NoDataException.INSTANCE;
- }
-
- @Override
- public SourcePosition getSourcePosition(@Nullable Location location) throws NoDataException {
- if (location == null) {
- throw NoDataException.INSTANCE;
- }
-
- return getSourcePosition(location.declaringType().name(), location.method().name(),
- location.method().signature(), (int)location.codeIndex());
- }
-
- @Override @NotNull
- public List getAllClasses(@NotNull SourcePosition classPosition) throws NoDataException {
- if (!(classPosition.getElementAt().getContainingFile() instanceof SmaliFile)) {
- throw NoDataException.INSTANCE;
- }
-
- String className = getClassFromPosition(classPosition);
- return debugProcess.getVirtualMachineProxy().classesByName(className);
- }
-
- @NotNull
- private String getClassFromPosition(@NotNull final SourcePosition position) {
- return ApplicationManager.getApplication().runReadAction(new Computable() {
- @Override public String compute() {
- SmaliClass smaliClass = ((SmaliFile)position.getElementAt().getContainingFile()).getPsiClass();
- if (smaliClass == null) {
- return "";
- }
- return smaliClass.getQualifiedName();
- }
- });
- }
-
- @Override @NotNull
- public List locationsOfLine(@NotNull final ReferenceType type,
- @NotNull final SourcePosition position) throws NoDataException {
- PsiFile containingFile = ApplicationManager.getApplication().runReadAction(new Computable() {
- @Override public PsiFile compute() {
- return position.getElementAt().getContainingFile();
- }
- });
-
- if (!(containingFile instanceof SmaliFile)) {
- throw NoDataException.INSTANCE;
- }
-
- final ArrayList locations = new ArrayList(1);
-
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
-
-
- String typeName = type.name();
- Collection classes = SmaliClassNameIndex.INSTANCE.get(typeName, debugProcess.getProject(),
- GlobalSearchScope.projectScope(debugProcess.getProject()));
-
- if (classes.size() > 0) {
- final SmaliClass smaliClass = classes.iterator().next();
-
- Location location = smaliClass.getLocationForSourcePosition(type, position);
-
- if (location != null) {
- locations.add(location);
- }
- }
- }
- });
- return locations;
- }
-
- @Override
- public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor,
- @NotNull final SourcePosition position) throws NoDataException {
- Computable isSmaliFile = new Computable() {
- @Override
- public Boolean compute() {
- return position.getFile() instanceof SmaliFile;
- }
- };
-
- ApplicationManager.getApplication().runReadAction(isSmaliFile);
-
- if (!isSmaliFile.compute()) {
- throw NoDataException.INSTANCE;
- }
-
- String className = getClassFromPosition(position);
- return debugProcess.getRequestsManager().createClassPrepareRequest(new ClassPrepareRequestor() {
- @Override
- public void processClassPrepare(DebugProcess debuggerProcess, ReferenceType referenceType) {
- requestor.processClassPrepare(debuggerProcess, referenceType);
- }
- }, className);
- }
-}
\ No newline at end of file
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliPositionManagerFactory.java b/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliPositionManagerFactory.java
deleted file mode 100644
index d78b57c8..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliPositionManagerFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging;
-
-import com.intellij.debugger.PositionManager;
-import com.intellij.debugger.PositionManagerFactory;
-import com.intellij.debugger.engine.DebugProcess;
-import org.jetbrains.annotations.NotNull;
-
-public class SmaliPositionManagerFactory extends PositionManagerFactory {
- @Override
- public PositionManager createPositionManager(@NotNull DebugProcess process) {
- return new SmaliPositionManager(process);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliSteppingCommandProvider.java b/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliSteppingCommandProvider.java
deleted file mode 100644
index 8c756810..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliSteppingCommandProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging;
-
-import com.intellij.debugger.SourcePosition;
-import com.intellij.debugger.engine.ContextUtil;
-import com.intellij.debugger.engine.DebugProcessImpl.ResumeCommand;
-import com.intellij.debugger.engine.SuspendContextImpl;
-import com.intellij.debugger.engine.events.DebuggerCommandImpl;
-import com.intellij.debugger.impl.JvmSteppingCommandProvider;
-import com.sun.jdi.request.StepRequest;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.SmaliLanguage;
-
-public class SmaliSteppingCommandProvider extends JvmSteppingCommandProvider {
- @Override
- public ResumeCommand getStepOverCommand(@NotNull final SuspendContextImpl suspendContext, boolean ignoreBreakpoints,
- int stepSize) {
-
- final SourcePosition[] location = new SourcePosition[1];
-
- suspendContext.getDebugProcess().getManagerThread().invokeAndWait(new DebuggerCommandImpl() {
- @Override protected void action() throws Exception {
- location[0] = ContextUtil.getSourcePosition(suspendContext);
- }
- }) ;
-
- if (location[0] != null && location[0].getFile().getLanguage() == SmaliLanguage.INSTANCE) {
- return suspendContext.getDebugProcess().createStepOverCommand(suspendContext, ignoreBreakpoints,
- StepRequest.STEP_MIN);
- }
- return null;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyArrayReference.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyArrayReference.java
deleted file mode 100644
index ad55a9f0..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyArrayReference.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.ArrayReference;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.Value;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-import java.util.List;
-
-public class LazyArrayReference extends LazyObjectReference implements ArrayReference {
- public LazyArrayReference(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- public Value getValue(int index) {
- return getValue().getValue(index);
- }
-
- public List getValues() {
- return getValue().getValues();
- }
-
- public List getValues(int index, int length) {
- return getValue().getValues(index, length);
- }
-
- public int length() {
- return getValue().length();
- }
-
- public void setValue(int index, Value value) throws InvalidTypeException, ClassNotLoadedException {
- getValue().setValue(index, value);
- }
-
- public void setValues(int index, List extends Value> values, int srcIndex, int length) throws InvalidTypeException, ClassNotLoadedException {
- getValue().setValues(index, values, srcIndex, length);
- }
-
- public void setValues(List extends Value> values) throws InvalidTypeException, ClassNotLoadedException {
- getValue().setValues(values);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyBooleanValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyBooleanValue.java
deleted file mode 100644
index e42da259..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyBooleanValue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.BooleanValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyBooleanValue extends LazyPrimitiveValue implements BooleanValue {
- public LazyBooleanValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public boolean value() {
- return getValue().value();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyByteValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyByteValue.java
deleted file mode 100644
index bc0e6a38..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyByteValue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.ByteValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyByteValue extends LazyComparablePrimitiveValue implements ByteValue {
- public LazyByteValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public byte value() {
- return getValue().value();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyCharValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyCharValue.java
deleted file mode 100644
index 0c536dd9..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyCharValue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.CharValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyCharValue extends LazyComparablePrimitiveValue implements CharValue {
- public LazyCharValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public char value() {
- return getValue().value();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyClassLoaderReference.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyClassLoaderReference.java
deleted file mode 100644
index dc41bbb5..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyClassLoaderReference.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.ClassLoaderReference;
-import com.sun.jdi.ReferenceType;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-import java.util.List;
-
-public class LazyClassLoaderReference extends LazyObjectReference
- implements ClassLoaderReference {
- public LazyClassLoaderReference(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- public List definedClasses() {
- return getValue().definedClasses();
- }
-
- public List visibleClasses() {
- return getValue().visibleClasses();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyClassObjectReference.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyClassObjectReference.java
deleted file mode 100644
index 62ac4203..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyClassObjectReference.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.ClassObjectReference;
-import com.sun.jdi.ReferenceType;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyClassObjectReference extends LazyObjectReference
- implements ClassObjectReference {
- public LazyClassObjectReference(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- public ReferenceType reflectedType() {
- return getValue().reflectedType();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyComparablePrimitiveValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyComparablePrimitiveValue.java
deleted file mode 100644
index e4a0b332..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyComparablePrimitiveValue.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.PrimitiveValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyComparablePrimitiveValue> extends LazyPrimitiveValue
- implements Comparable {
- public LazyComparablePrimitiveValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- public int compareTo(T o) {
- return getValue().compareTo(o);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyDoubleValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyDoubleValue.java
deleted file mode 100644
index ae9e17a8..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyDoubleValue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.DoubleValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyDoubleValue extends LazyComparablePrimitiveValue implements DoubleValue {
- public LazyDoubleValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public double value() {
- return getValue().value();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyFloatValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyFloatValue.java
deleted file mode 100644
index 54041cd6..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyFloatValue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.FloatValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyFloatValue extends LazyComparablePrimitiveValue implements FloatValue {
- public LazyFloatValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public float value() {
- return getValue().value();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyIntegerValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyIntegerValue.java
deleted file mode 100644
index 87b13caf..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyIntegerValue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.IntegerValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyIntegerValue extends LazyComparablePrimitiveValue implements IntegerValue {
- public LazyIntegerValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public int value() {
- return getValue().value();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyLongValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyLongValue.java
deleted file mode 100644
index e1c1aafc..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyLongValue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.LongValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyLongValue extends LazyComparablePrimitiveValue implements LongValue {
- public LazyLongValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public long value() {
- return getValue().value();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyObjectReference.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyObjectReference.java
deleted file mode 100644
index 9f50bf3f..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyObjectReference.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.*;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-import java.util.List;
-import java.util.Map;
-
-public class LazyObjectReference extends LazyValue implements ObjectReference {
-
- public LazyObjectReference(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public void disableCollection() {
- getValue().disableCollection();
- }
-
- @Override public ReferenceType referenceType() {
- return getValue().referenceType();
- }
-
- @Override public Value getValue(Field sig) {
- return getValue().getValue(sig);
- }
-
- @Override public Map getValues(List extends Field> fields) {
- return getValue().getValues(fields);
- }
-
- @Override public void setValue(Field field, Value value) throws InvalidTypeException, ClassNotLoadedException {
- getValue().setValue(field, value);
- }
-
- @Override
- public Value invokeMethod(ThreadReference thread, Method method, List extends Value> arguments, int options)
- throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException,
- InvocationException {
- return getValue().invokeMethod(thread, method, arguments, options);
- }
-
- @Override public void enableCollection() {
- getValue().enableCollection();
- }
-
- @Override public boolean isCollected() {
- return getValue().isCollected();
- }
-
- @Override public long uniqueID() {
- return getValue().uniqueID();
- }
-
- @Override public List waitingThreads() throws IncompatibleThreadStateException {
- return getValue().waitingThreads();
- }
-
- @Override public ThreadReference owningThread() throws IncompatibleThreadStateException {
- return getValue().owningThread();
- }
-
- @Override public int entryCount() throws IncompatibleThreadStateException {
- return getValue().entryCount();
- }
-
- @Override public List referringObjects(long maxReferrers) {
- return getValue().referringObjects(maxReferrers);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyPrimitiveValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyPrimitiveValue.java
deleted file mode 100644
index 65d36357..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyPrimitiveValue.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.PrimitiveValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyPrimitiveValue extends LazyValue implements PrimitiveValue {
- public LazyPrimitiveValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public boolean booleanValue() {
- return getValue().booleanValue();
- }
-
- @Override public byte byteValue() {
- return getValue().byteValue();
- }
-
- @Override public char charValue() {
- return getValue().charValue();
- }
-
- @Override public double doubleValue() {
- return getValue().doubleValue();
- }
-
- @Override public float floatValue() {
- return getValue().floatValue();
- }
-
- @Override public int intValue() {
- return getValue().intValue();
- }
-
- @Override public long longValue() {
- return getValue().longValue();
- }
-
- @Override public short shortValue() {
- return getValue().shortValue();
- }
-
- @Override public String toString() {
- return getValue().toString();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyShortValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyShortValue.java
deleted file mode 100644
index 10a5fa32..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyShortValue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.ShortValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyShortValue extends LazyComparablePrimitiveValue implements ShortValue {
- public LazyShortValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public short value() {
- return getValue().value();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyStringReference.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyStringReference.java
deleted file mode 100644
index 2b52e2b7..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyStringReference.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiSubstitutor;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.StringReference;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyStringReference extends LazyObjectReference implements StringReference {
- public LazyStringReference(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- public String value() {
- ObjectReference objectReference = getValue();
- if (!(objectReference instanceof StringReference)) {
- throw new IllegalStateException(String.format("Expecting type String, but got %s. method=%s, register=%d",
- objectReference.type().name(), this.method.getSignature(PsiSubstitutor.EMPTY), registerNumber));
- }
- return getValue().value();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyThreadGroupReference.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyThreadGroupReference.java
deleted file mode 100644
index 05f05d63..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyThreadGroupReference.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.ThreadGroupReference;
-import com.sun.jdi.ThreadReference;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-import java.util.List;
-
-public class LazyThreadGroupReference extends LazyObjectReference
- implements ThreadGroupReference {
-
- public LazyThreadGroupReference(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- @Override public String name() {
- return getValue().name();
- }
-
- @Override public ThreadGroupReference parent() {
- return getValue().parent();
- }
-
- @Override public void resume() {
- getValue().resume();
- }
-
- @Override public void suspend() {
- getValue().suspend();
- }
-
- @Override public List threadGroups() {
- return getValue().threadGroups();
- }
-
- @Override public List threads() {
- return getValue().threads();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyThreadReference.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyThreadReference.java
deleted file mode 100644
index 61a13f88..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyThreadReference.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.*;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-import java.util.List;
-
-public class LazyThreadReference extends LazyObjectReference implements ThreadReference {
- public LazyThreadReference(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-
- public ObjectReference currentContendedMonitor() throws IncompatibleThreadStateException {
- return getValue().currentContendedMonitor();
- }
-
- public void forceEarlyReturn(Value value) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException {
- getValue().forceEarlyReturn(value);
- }
-
- public StackFrame frame(int index) throws IncompatibleThreadStateException {
- return getValue().frame(index);
- }
-
- public int frameCount() throws IncompatibleThreadStateException {
- return getValue().frameCount();
- }
-
- public List frames() throws IncompatibleThreadStateException {
- return getValue().frames();
- }
-
- public List frames(int start, int length) throws IncompatibleThreadStateException {
- return getValue().frames(start, length);
- }
-
- public void interrupt() {
- getValue().interrupt();
- }
-
- public boolean isAtBreakpoint() {
- return getValue().isAtBreakpoint();
- }
-
- public boolean isSuspended() {
- return getValue().isSuspended();
- }
-
- public String name() {
- return getValue().name();
- }
-
- public List ownedMonitors() throws IncompatibleThreadStateException {
- return getValue().ownedMonitors();
- }
-
- public List ownedMonitorsAndFrames() throws IncompatibleThreadStateException {
- return getValue().ownedMonitorsAndFrames();
- }
-
- public void popFrames(StackFrame frame) throws IncompatibleThreadStateException {
- getValue().popFrames(frame);
- }
-
- public void resume() {
- getValue().resume();
- }
-
- public int status() {
- return getValue().status();
- }
-
- public void stop(ObjectReference throwable) throws InvalidTypeException {
- getValue().stop(throwable);
- }
-
- public void suspend() {
- getValue().suspend();
- }
-
- public int suspendCount() {
- return getValue().suspendCount();
- }
-
- public ThreadGroupReference threadGroup() {
- return getValue().threadGroup();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyValue.java
deleted file mode 100644
index f17df6d7..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyValue.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.debugger.DebuggerManagerEx;
-import com.intellij.debugger.engine.DebugProcessImpl;
-import com.intellij.debugger.engine.evaluation.EvaluateException;
-import com.intellij.debugger.engine.evaluation.EvaluationContext;
-import com.intellij.debugger.impl.DebuggerContextImpl;
-import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.Type;
-import com.sun.jdi.Value;
-import com.sun.jdi.VirtualMachine;
-import org.jf.smalidea.debugging.SmaliCodeFragmentFactory;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-public class LazyValue implements Value {
- protected final int registerNumber;
- protected final Project project;
- protected final SmaliMethod method;
- protected final String type;
-
- private EvaluationContext evaluationContext;
- private Value value;
-
- public LazyValue(SmaliMethod method, Project project, int registerNumber, String type) {
- this.method = method;
- this.project = project;
- this.registerNumber = registerNumber;
- this.type = type;
- }
-
- public static LazyValue create(@Nonnull SmaliMethod method, @Nonnull Project project, int registerNumber,
- @Nonnull String type) {
- if (type.equals("B")) {
- return new LazyByteValue(method, project, registerNumber, type);
- } else if (type.equals("S")) {
- return new LazyShortValue(method, project, registerNumber, type);
- } else if (type.equals("J")) {
- return new LazyLongValue(method, project, registerNumber, type);
- } else if (type.equals("I")) {
- return new LazyIntegerValue(method, project, registerNumber, type);
- } else if (type.equals("F")) {
- return new LazyFloatValue(method, project, registerNumber, type);
- } else if (type.equals("D")) {
- return new LazyDoubleValue(method, project, registerNumber, type);
- } else if (type.equals("Z")) {
- return new LazyBooleanValue(method, project, registerNumber, type);
- } else if (type.equals("C")) {
- return new LazyCharValue(method, project, registerNumber, type);
- } else if (type.equals("V")) {
- return new LazyVoidValue(method, project, registerNumber, type);
- } else if (type.startsWith("[")) {
- return new LazyArrayReference(method, project, registerNumber, type);
- } else if (type.equals("Ljava/lang/String;")) {
- return new LazyStringReference(method, project, registerNumber, type);
- } else if (type.equals("Ljava/lang/Class;")) {
- return new LazyClassObjectReference(method, project, registerNumber, type);
- } else if (type.equals("Ljava/lang/ThreadGroup;")) {
- return new LazyThreadGroupReference(method, project, registerNumber, type);
- } else if (type.equals("Ljava/lang/Thread;")) {
- return new LazyThreadReference(method, project, registerNumber, type);
- } else if (type.equals("Ljava/lang/ClassLoader;")) {
- return new LazyClassLoaderReference(method, project, registerNumber, type);
- } else if (type.startsWith("L")) {
- return new LazyObjectReference(method, project, registerNumber, type);
- }
- return new LazyValue(method, project, registerNumber, type);
- }
-
- @Nullable
- protected T getNullableValue(boolean allowNull) {
- if (value == null) {
- try {
- if (evaluationContext == null) {
- final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(project).getContext();
- evaluationContext = debuggerContext.createEvaluationContext();
- if (evaluationContext == null) {
- if (!allowNull) {
- throw new IllegalStateException("Can't create evaluation context");
- }
- return null;
- }
- }
-
- value = SmaliCodeFragmentFactory.evaluateRegister(evaluationContext, method, registerNumber, type);
- evaluationContext = null;
- } catch (EvaluateException ex) {
- if (!allowNull) {
- throw new IllegalStateException(ex);
- }
- return null;
- }
- }
- return (T)value;
- }
-
- @Nonnull
- protected T getValue() {
- T value = getNullableValue(false);
- assert value != null;
- return value;
- }
-
- @Override
- public Type type() {
- return getValue().type();
- }
-
- @Override
- public VirtualMachine virtualMachine() {
- if (evaluationContext != null) {
- return ((VirtualMachineProxyImpl)evaluationContext.getDebugProcess().getVirtualMachineProxy())
- .getVirtualMachine();
- } else {
- final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(project).getContext();
- final DebugProcessImpl process = debuggerContext.getDebugProcess();
- if (process != null) {
- return process.getVirtualMachineProxy().getVirtualMachine();
- }
- }
- return null;
- }
-
- public void setEvaluationContext(@Nonnull EvaluationContext evaluationContext) {
- this.evaluationContext = evaluationContext;
- }
-
- @Override public boolean equals(Object obj) {
- Value value = getNullableValue(true);
- if (value != null) {
- return value.equals(obj);
- }
- return super.equals(obj);
- }
-
- @Override public int hashCode() {
- Value value = getNullableValue(true);
- if (value != null) {
- return value.hashCode();
- }
- return super.hashCode();
- }
-
- @Override public String toString() {
- Value value = getNullableValue(true);
- if (value != null) {
- return value.toString();
- }
- return super.toString();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyVoidValue.java b/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyVoidValue.java
deleted file mode 100644
index a7f6bdc5..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/debugging/value/LazyVoidValue.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.debugging.value;
-
-import com.intellij.openapi.project.Project;
-import com.sun.jdi.VoidValue;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-
-public class LazyVoidValue extends LazyValue implements VoidValue {
- public LazyVoidValue(SmaliMethod method, Project project, int registerNumber, String type) {
- super(method, project, registerNumber, type);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaClassDef.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaClassDef.java
deleted file mode 100644
index c954702a..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaClassDef.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiField;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.PsiModifierList;
-import org.jf.dexlib2.AccessFlags;
-import org.jf.dexlib2.base.reference.BaseTypeReference;
-import org.jf.dexlib2.iface.Annotation;
-import org.jf.dexlib2.iface.ClassDef;
-import org.jf.dexlib2.iface.Field;
-import org.jf.dexlib2.iface.Method;
-import org.jf.smalidea.util.NameUtils;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
-public class SmalideaClassDef extends BaseTypeReference implements ClassDef {
- private final PsiClass psiClass;
-
- public SmalideaClassDef(PsiClass psiClass) {
- this.psiClass = psiClass;
- }
-
- @Override public int getAccessFlags() {
- PsiModifierList modifierList = psiClass.getModifierList();
- int flags = 0;
-
- if (modifierList == null) {
- return flags;
- }
-
- if (modifierList.hasModifierProperty("public")) {
- flags |= AccessFlags.PUBLIC.getValue();
- }
-
- if (modifierList.hasModifierProperty("final")) {
- flags |= AccessFlags.FINAL.getValue();
- }
-
- if (modifierList.hasModifierProperty("abstract")) {
- flags |= AccessFlags.ABSTRACT.getValue();
- }
-
- if (psiClass.isInterface()) {
- flags |= AccessFlags.INTERFACE.getValue();
- }
-
- if (psiClass.isEnum()) {
- flags |= AccessFlags.ENUM.getValue();
- }
-
- if (psiClass.isAnnotationType()) {
- flags |= AccessFlags.ANNOTATION.getValue();
- }
-
- return flags;
- }
-
- @Nonnull @Override public String getType() {
- return NameUtils.javaToSmaliType(psiClass);
- }
-
- @Nullable @Override public String getSuperclass() {
- PsiClass superClass = psiClass.getSuperClass();
- if (superClass == null) {
- return null;
- }
- return NameUtils.javaToSmaliType(superClass);
- }
-
- @Nonnull @Override public List getInterfaces() {
- List interfaceList = Lists.newArrayList();
- PsiClass[] interfaces = psiClass.getInterfaces();
- if (interfaces == null) {
- return interfaceList;
- }
-
- for (PsiClass psiClass: interfaces) {
- interfaceList.add(NameUtils.javaToSmaliType(psiClass));
- }
-
- return interfaceList;
- }
-
- @Nullable @Override public String getSourceFile() {
- return null;
- }
-
- @Nonnull @Override public Set extends Annotation> getAnnotations() {
- return ImmutableSet.of();
- }
-
- @Nonnull @Override public Iterable extends Field> getStaticFields() {
- return Iterables.transform(
- Iterables.filter(Arrays.asList(psiClass.getFields()), new Predicate() {
- @Override public boolean apply(PsiField psiField) {
- PsiModifierList modifierList = psiField.getModifierList();
- if (modifierList == null) {
- return false;
- }
- return modifierList.hasModifierProperty("static");
- }
- }),
- new Function() {
- @Nullable @Override public Field apply(@Nullable PsiField psiField) {
- return new SmalideaField(psiField);
- }
- });
- }
-
- @Nonnull @Override public Iterable extends Field> getInstanceFields() {
- return Iterables.transform(
- Iterables.filter(Arrays.asList(psiClass.getFields()), new Predicate() {
- @Override public boolean apply(PsiField psiField) {
- PsiModifierList modifierList = psiField.getModifierList();
- if (modifierList == null) {
- return true;
- }
- return !modifierList.hasModifierProperty("static");
- }
- }),
- new Function() {
- @Nullable @Override public Field apply(@Nullable PsiField psiField) {
- return new SmalideaField(psiField);
- }
- });
- }
-
- @Nonnull @Override public Iterable extends Field> getFields() {
- return Iterables.concat(getStaticFields(), getInstanceFields());
- }
-
- @Nonnull @Override public Iterable extends Method> getDirectMethods() {
- return Iterables.transform(
- Iterables.filter(
- Iterables.concat(
- Arrays.asList(psiClass.getConstructors()),
- Arrays.asList(psiClass.getMethods())),
- new Predicate() {
- @Override public boolean apply(PsiMethod psiMethod) {
- PsiModifierList modifierList = psiMethod.getModifierList();
- return modifierList.hasModifierProperty("static") ||
- modifierList.hasModifierProperty("private") ||
- modifierList.hasModifierProperty("constructor");
- }
- }),
- new Function() {
- @Nullable @Override public Method apply(PsiMethod psiMethod) {
- return new SmalideaMethod(psiMethod);
- }
- });
- }
-
- @Nonnull @Override public Iterable extends Method> getVirtualMethods() {
- return Iterables.transform(
- Iterables.filter(Arrays.asList(psiClass.getMethods()), new Predicate() {
- @Override public boolean apply(PsiMethod psiMethod) {
- PsiModifierList modifierList = psiMethod.getModifierList();
- return !modifierList.hasModifierProperty("static") &&
- !modifierList.hasModifierProperty("private") &&
- !modifierList.hasModifierProperty("constructor");
- }
- }),
- new Function() {
- @Nullable @Override public Method apply(PsiMethod psiMethod) {
- return new SmalideaMethod(psiMethod);
- }
- });
- }
-
- @Nonnull @Override public Iterable extends Method> getMethods() {
- return Iterables.concat(getDirectMethods(), getVirtualMethods());
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaExceptionHandler.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaExceptionHandler.java
deleted file mode 100644
index 72909b63..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaExceptionHandler.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib;
-
-import org.jf.dexlib2.base.BaseExceptionHandler;
-import org.jf.smalidea.psi.impl.SmaliCatchStatement;
-import org.jf.smalidea.psi.impl.SmaliClassTypeElement;
-import org.jf.smalidea.psi.impl.SmaliLabel;
-import org.jf.smalidea.psi.impl.SmaliLabelReference;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-public class SmalideaExceptionHandler extends BaseExceptionHandler {
- @Nonnull private final SmaliCatchStatement catchStatement;
-
- public SmalideaExceptionHandler(@Nonnull SmaliCatchStatement catchStatement) {
- this.catchStatement = catchStatement;
- }
-
- @Nullable @Override public String getExceptionType() {
- SmaliClassTypeElement exceptionType = catchStatement.getExceptionType();
- if (exceptionType == null) {
- return null;
- }
- return exceptionType.getText();
- }
-
- @Override public int getHandlerCodeAddress() {
- SmaliLabelReference handlerLabel = catchStatement.getHandlerLabel();
- // TODO: how to handle a reference to a non-existent label..
- SmaliLabel smaliLabel = handlerLabel.resolve();
- return smaliLabel.getOffset() / 2;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaField.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaField.java
deleted file mode 100644
index 7b98174a..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaField.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib;
-
-import com.google.common.collect.ImmutableSet;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiField;
-import com.intellij.psi.PsiModifierList;
-import org.jf.dexlib2.AccessFlags;
-import org.jf.dexlib2.base.reference.BaseFieldReference;
-import org.jf.dexlib2.iface.Annotation;
-import org.jf.dexlib2.iface.Field;
-import org.jf.dexlib2.iface.value.EncodedValue;
-import org.jf.smalidea.psi.impl.SmaliField;
-import org.jf.smalidea.util.NameUtils;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import java.util.Set;
-
-public class SmalideaField extends BaseFieldReference implements Field {
- private final PsiField psiField;
-
- public SmalideaField(PsiField psiField) {
- this.psiField = psiField;
- }
-
- @Override public int getAccessFlags() {
- if (psiField instanceof SmaliField) {
- return ((SmaliField)psiField).getModifierList().getAccessFlags();
- } else {
- int flags = 0;
- PsiModifierList modifierList = psiField.getModifierList();
- if (modifierList == null) {
- return flags;
- }
- if (modifierList.hasModifierProperty("public")) {
- flags |= AccessFlags.PUBLIC.getValue();
- } else if (modifierList.hasModifierProperty("protected")) {
- flags |= AccessFlags.PROTECTED.getValue();
- } else if (modifierList.hasModifierProperty("private")) {
- flags |= AccessFlags.PRIVATE.getValue();
- }
-
- if (modifierList.hasModifierProperty("static")) {
- flags |= AccessFlags.STATIC.getValue();
- }
-
- if (modifierList.hasModifierProperty("final")) {
- flags |= AccessFlags.FINAL.getValue();
- }
-
- if (modifierList.hasModifierProperty("volatile")) {
- flags |= AccessFlags.VOLATILE.getValue();
- }
- // TODO: how do we tell if it's an enum?
-
- return flags;
- }
- }
-
- @Nonnull @Override public String getDefiningClass() {
- PsiClass containingClass = psiField.getContainingClass();
- if (containingClass == null) {
- throw new RuntimeException("I don't know what to do here... Is this even possible?");
- }
- return NameUtils.javaToSmaliType(containingClass);
- }
-
- @Nonnull @Override public String getName() {
- return psiField.getNameIdentifier().getText();
- }
-
- @Nonnull @Override public String getType() {
- return NameUtils.javaToSmaliType(psiField.getType());
- }
-
- @Nullable @Override public EncodedValue getInitialValue() {
- // TODO: implement this. Not needed for method analysis
- return null;
- }
-
- @Nonnull @Override public Set extends Annotation> getAnnotations() {
- // TODO: implement this. Not needed for method analysis
- return ImmutableSet.of();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaMethod.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaMethod.java
deleted file mode 100644
index abc4dda8..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaMethod.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.PsiModifierList;
-import com.intellij.psi.PsiParameter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.dexlib2.AccessFlags;
-import org.jf.dexlib2.base.reference.BaseMethodReference;
-import org.jf.dexlib2.iface.*;
-import org.jf.dexlib2.iface.debug.DebugItem;
-import org.jf.dexlib2.iface.instruction.Instruction;
-import org.jf.smalidea.dexlib.instruction.SmalideaInstruction;
-import org.jf.smalidea.psi.impl.SmaliCatchStatement;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-import org.jf.smalidea.psi.impl.SmaliMethod;
-import org.jf.smalidea.util.NameUtils;
-
-import javax.annotation.Nonnull;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
-public class SmalideaMethod extends BaseMethodReference implements Method {
- private final PsiMethod psiMethod;
-
- public SmalideaMethod(@NotNull PsiMethod psiMethod) {
- this.psiMethod = psiMethod;
- }
-
- @Nonnull @Override public String getDefiningClass() {
- PsiClass cls = psiMethod.getContainingClass();
- assert cls != null;
- return NameUtils.javaToSmaliType(cls);
- }
-
- @Nonnull @Override public List extends MethodParameter> getParameters() {
- PsiParameter[] parameters = psiMethod.getParameterList().getParameters();
-
- return Lists.transform(Arrays.asList(parameters), new Function() {
- @Nullable @Override
- public MethodParameter apply(@Nullable PsiParameter psiParameter) {
- if (psiParameter == null) {
- return null;
- }
- return new SmalideaMethodParameter(psiParameter);
- }
- });
- }
-
- @Override public int getAccessFlags() {
- if (psiMethod instanceof SmaliMethod) {
- return ((SmaliMethod)psiMethod).getModifierList().getAccessFlags();
- } else {
- int flags = 0;
- PsiModifierList modifierList = psiMethod.getModifierList();
- if (modifierList.hasModifierProperty("public")) {
- flags |= AccessFlags.PUBLIC.getValue();
- } else if (modifierList.hasModifierProperty("protected")) {
- flags |= AccessFlags.PROTECTED.getValue();
- } else if (modifierList.hasModifierProperty("private")) {
- flags |= AccessFlags.PRIVATE.getValue();
- }
-
- if (modifierList.hasModifierProperty("static")) {
- flags |= AccessFlags.STATIC.getValue();
- }
-
- if (modifierList.hasModifierProperty("final")) {
- flags |= AccessFlags.FINAL.getValue();
- }
-
- boolean isNative = false;
- if (modifierList.hasModifierProperty("native")) {
- flags |= AccessFlags.NATIVE.getValue();
- isNative = true;
- }
-
- if (modifierList.hasModifierProperty("synchronized")) {
- if (isNative) {
- flags |= AccessFlags.SYNCHRONIZED.getValue();
- } else {
- flags |= AccessFlags.DECLARED_SYNCHRONIZED.getValue();
- }
- }
-
- if (psiMethod.isVarArgs()) {
- flags |= AccessFlags.VARARGS.getValue();
- }
-
- if (modifierList.hasModifierProperty("abstract")) {
- flags |= AccessFlags.ABSTRACT.getValue();
- }
-
- if (modifierList.hasModifierProperty("strictfp")) {
- flags |= AccessFlags.STRICTFP.getValue();
- }
-
- if (psiMethod.isConstructor()) {
- flags |= AccessFlags.CONSTRUCTOR.getValue();
- }
- return flags;
- }
- }
-
- @Nonnull @Override public Set extends Annotation> getAnnotations() {
- // TODO: implement this
- return ImmutableSet.of();
- }
-
- @Nullable @Override public MethodImplementation getImplementation() {
- if (psiMethod instanceof SmaliMethod) {
- final SmaliMethod smaliMethod = (SmaliMethod)this.psiMethod;
-
- List instructions = smaliMethod.getInstructions();
- if (instructions.size() == 0) {
- return null;
- }
-
- // TODO: cache this?
- return new MethodImplementation() {
- @Override public int getRegisterCount() {
- return smaliMethod.getRegisterCount();
- }
-
- @Nonnull @Override public Iterable extends Instruction> getInstructions() {
- return Lists.transform(smaliMethod.getInstructions(),
- new Function() {
- @Override
- public Instruction apply(SmaliInstruction smaliInstruction) {
- return SmalideaInstruction.of(smaliInstruction);
- }
- });
- }
-
- @Nonnull @Override public List extends TryBlock extends ExceptionHandler>> getTryBlocks() {
- return Lists.transform(smaliMethod.getCatchStatements(),
- new Function>() {
- @Override
- public TryBlock extends ExceptionHandler> apply(
- SmaliCatchStatement smaliCatchStatement) {
- assert smaliCatchStatement != null;
- return new SmalideaTryBlock(smaliCatchStatement);
- }
- });
- }
-
- @Nonnull @Override public Iterable extends DebugItem> getDebugItems() {
- // TODO: implement this
- return ImmutableList.of();
- }
- };
- }
- return null;
- }
-
- @Nonnull @Override public String getName() {
- return psiMethod.getName();
- }
-
- @Nonnull @Override public List extends CharSequence> getParameterTypes() {
- PsiParameter[] parameters = psiMethod.getParameterList().getParameters();
-
- return Lists.transform(Arrays.asList(parameters), new Function() {
- @Nullable @Override
- public CharSequence apply(@Nullable PsiParameter psiParameter) {
- if (psiParameter == null) {
- return null;
- }
- return psiParameter.getText();
- }
- });
- }
-
- @Nonnull @Override public String getReturnType() {
- return psiMethod.getReturnTypeElement().getText();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaMethodParameter.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaMethodParameter.java
deleted file mode 100644
index 49d75c83..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaMethodParameter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib;
-
-import com.google.common.collect.ImmutableSet;
-import com.intellij.psi.PsiParameter;
-import org.jetbrains.annotations.Nullable;
-import org.jf.dexlib2.base.BaseMethodParameter;
-import org.jf.dexlib2.iface.Annotation;
-import org.jf.smalidea.util.NameUtils;
-import org.jf.smalidea.util.StringUtils;
-
-import javax.annotation.Nonnull;
-import java.util.Set;
-
-public class SmalideaMethodParameter extends BaseMethodParameter {
- private final PsiParameter psiParameter;
-
- public SmalideaMethodParameter(PsiParameter psiParameter) {
- this.psiParameter = psiParameter;
- }
-
- @Nonnull @Override public Set extends Annotation> getAnnotations() {
- // TODO: implement this
- return ImmutableSet.of();
- }
-
- @Nullable @Override public String getName() {
- return StringUtils.parseQuotedString(psiParameter.getName());
- }
-
- @Nonnull @Override public String getType() {
- return NameUtils.javaToSmaliType(psiParameter.getType());
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaTryBlock.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaTryBlock.java
deleted file mode 100644
index 6fbab593..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/SmalideaTryBlock.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib;
-
-import org.jf.dexlib2.base.BaseTryBlock;
-import org.jf.smalidea.psi.impl.SmaliCatchStatement;
-
-import javax.annotation.Nonnull;
-import java.util.Arrays;
-import java.util.List;
-
-public class SmalideaTryBlock extends BaseTryBlock {
- @Nonnull private final SmaliCatchStatement catchStatement;
-
- public SmalideaTryBlock(@Nonnull SmaliCatchStatement catchStatement) {
- this.catchStatement = catchStatement;
- }
-
- @Override public int getCodeUnitCount() {
- int endOffset = catchStatement.getEndLabel().resolve().getOffset() / 2;
- return endOffset - getStartCodeAddress();
- }
-
- @Override public int getStartCodeAddress() {
- // TODO: how to handle references to non-existent labels?
- return catchStatement.getStartLabel().resolve().getOffset() / 2;
- }
-
- @Nonnull @Override public List extends SmalideaExceptionHandler> getExceptionHandlers() {
- return Arrays.asList(new SmalideaExceptionHandler(catchStatement));
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/analysis/SmalideaClassProvider.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/analysis/SmalideaClassProvider.java
deleted file mode 100644
index 9d2a14ac..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/analysis/SmalideaClassProvider.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.jf.smalidea.dexlib.analysis;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.impl.ResolveScopeManager;
-import org.jf.dexlib2.analysis.ClassProvider;
-import org.jf.dexlib2.iface.ClassDef;
-import org.jf.smalidea.dexlib.SmalideaClassDef;
-import org.jf.smalidea.util.NameUtils;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-public class SmalideaClassProvider implements ClassProvider {
- private final Project project;
- private final VirtualFile file;
-
- public SmalideaClassProvider(@Nonnull Project project, @Nonnull VirtualFile file) {
- this.project = project;
- this.file = file;
- }
-
- @Nullable @Override public ClassDef getClassDef(String type) {
- ResolveScopeManager manager = ResolveScopeManager.getInstance(project);
- PsiClass psiClass = NameUtils.resolveSmaliType(project, manager.getDefaultResolveScope(file), type);
- if (psiClass != null) {
- return new SmalideaClassDef(psiClass);
- }
- return null;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaArrayPayload.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaArrayPayload.java
deleted file mode 100644
index 26f2daf7..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaArrayPayload.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import org.jf.dexlib2.iface.instruction.formats.ArrayPayload;
-import org.jf.smalidea.psi.impl.SmaliArrayDataElement;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import java.util.List;
-
-public class SmalideaArrayPayload extends SmalideaInstruction implements ArrayPayload {
- public SmalideaArrayPayload(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-
- @Override public int getElementWidth() {
- return (int)psiInstruction.getArrayDataWidth().getIntegralValue();
- }
-
- @Nonnull @Override public List getArrayElements() {
- return Lists.transform(psiInstruction.getArrayDataElements(), new Function() {
- @Nullable @Override public Number apply(SmaliArrayDataElement smaliArrayDataElement) {
- return smaliArrayDataElement.getValue().getIntegralValue();
- }
- });
- }
-
- @Override public int getCodeUnits() {
- return psiInstruction.getInstructionSize()/2;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction.java
deleted file mode 100644
index b5b259a2..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import com.intellij.psi.PsiType;
-import org.jf.dexlib2.Opcode;
-import org.jf.dexlib2.ReferenceType;
-import org.jf.dexlib2.iface.instruction.Instruction;
-import org.jf.dexlib2.iface.reference.Reference;
-import org.jf.dexlib2.immutable.reference.ImmutableFieldReference;
-import org.jf.dexlib2.immutable.reference.ImmutableMethodReference;
-import org.jf.dexlib2.immutable.reference.ImmutableStringReference;
-import org.jf.dexlib2.immutable.reference.ImmutableTypeReference;
-import org.jf.smalidea.psi.impl.*;
-import org.jf.smalidea.util.NameUtils;
-import org.jf.smalidea.util.StringUtils;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import java.util.List;
-
-public abstract class SmalideaInstruction implements Instruction {
- @Nonnull protected final SmaliInstruction psiInstruction;
-
- protected SmalideaInstruction(@Nonnull SmaliInstruction instruction) {
- this.psiInstruction = instruction;
- }
-
- @Nonnull
- public static SmalideaInstruction of(SmaliInstruction instruction) {
- switch (instruction.getOpcode().format) {
- case Format10t:
- return new SmalideaInstruction10t(instruction);
- case Format10x:
- return new SmalideaInstruction10x(instruction);
- case Format11n:
- return new SmalideaInstruction11n(instruction);
- case Format11x:
- return new SmalideaInstruction11x(instruction);
- case Format12x:
- return new SmalideaInstruction12x(instruction);
- case Format20t:
- return new SmalideaInstruction20t(instruction);
- case Format21c:
- return new SmalideaInstruction21c(instruction);
- case Format21ih:
- return new SmalideaInstruction21ih(instruction);
- case Format21lh:
- return new SmalideaInstruction21lh(instruction);
- case Format21s:
- return new SmalideaInstruction21s(instruction);
- case Format21t:
- return new SmalideaInstruction21t(instruction);
- case Format22b:
- return new SmalideaInstruction22b(instruction);
- case Format22c:
- return new SmalideaInstruction22c(instruction);
- case Format22s:
- return new SmalideaInstruction22s(instruction);
- case Format22t:
- return new SmalideaInstruction22t(instruction);
- case Format22x:
- return new SmalideaInstruction22x(instruction);
- case Format23x:
- return new SmalideaInstruction23x(instruction);
- case Format30t:
- return new SmalideaInstruction30t(instruction);
- case Format31c:
- return new SmalideaInstruction31c(instruction);
- case Format31i:
- return new SmalideaInstruction31i(instruction);
- case Format31t:
- return new SmalideaInstruction31t(instruction);
- case Format32x:
- return new SmalideaInstruction32x(instruction);
- case Format35c:
- return new SmalideaInstruction35c(instruction);
- case Format3rc:
- return new SmalideaInstruction3rc(instruction);
- case Format51l:
- return new SmalideaInstruction51l(instruction);
- case PackedSwitchPayload:
- return new SmalideaPackedSwitchPayload(instruction);
- case SparseSwitchPayload:
- return new SmalideaSparseSwitchPayload(instruction);
- case ArrayPayload:
- return new SmalideaArrayPayload(instruction);
- default:
- throw new RuntimeException("Unexpected instruction type");
- }
- }
-
- @Nonnull public Opcode getOpcode() {
- return psiInstruction.getOpcode();
- }
-
- public int getCodeUnits() {
- return getOpcode().format.size / 2;
- }
-
- public int getCodeOffset() {
- SmaliLabelReference labelReference = psiInstruction.getTarget();
- if (labelReference == null) {
- return -1;
- }
-
- SmaliLabel label = labelReference.resolve();
- if (label == null) {
- return -1;
- }
- return (label.getOffset() - psiInstruction.getOffset())/2;
- }
-
- public int getRegisterCount() {
- return psiInstruction.getRegisterCount();
- }
-
- public int getRegisterA() {
- return psiInstruction.getRegister(0);
- }
-
- public int getRegisterB() {
- return psiInstruction.getRegister(1);
- }
-
- public int getRegisterC() {
- return psiInstruction.getRegister(2);
- }
-
- public int getNarrowLiteral() {
- SmaliLiteral literal = psiInstruction.getLiteral();
- if (literal == null) {
- return 0;
- }
- return (int)literal.getIntegralValue();
- }
-
- public long getWideLiteral() {
- SmaliLiteral literal = psiInstruction.getLiteral();
- if (literal == null) {
- return 0;
- }
- return literal.getIntegralValue();
- }
-
- @Nonnull public Reference getReference() {
- switch (getReferenceType()) {
- case ReferenceType.STRING:
- return new ImmutableStringReference(StringUtils.parseQuotedString(
- psiInstruction.getLiteral().getText()));
- case ReferenceType.TYPE:
- SmaliTypeElement typeReference = psiInstruction.getTypeReference();
- assert typeReference != null;
- return new ImmutableTypeReference(typeReference.getText());
- case ReferenceType.METHOD:
- SmaliMethodReference methodReference = psiInstruction.getMethodReference();
- assert methodReference != null;
- String containingClass = methodReference.getContainingType().getText();
- List paramTypes =
- Lists.transform(methodReference.getParameterTypes(), new Function() {
- @Nullable @Override public String apply(@Nullable PsiType psiType) {
- if (psiType == null) {
- return null;
- }
- return NameUtils.javaToSmaliType(psiType);
- }
- });
-
- return new ImmutableMethodReference(containingClass,
- methodReference.getName(),
- paramTypes,
- methodReference.getReturnType().getText());
- case ReferenceType.FIELD:
- SmaliFieldReference fieldReference = psiInstruction.getFieldReference();
- assert fieldReference != null;
- containingClass = fieldReference.getContainingType().getText();
- return new ImmutableFieldReference(containingClass,
- fieldReference.getName(),
- fieldReference.getFieldType().getText());
- }
- assert false;
- return null;
- }
-
- public int getReferenceType() {
- return psiInstruction.getOpcode().referenceType;
- }
-
-}
\ No newline at end of file
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction10t.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction10t.java
deleted file mode 100644
index 80a4ba66..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction10t.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction10t;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction10t extends SmalideaInstruction implements Instruction10t {
- public SmalideaInstruction10t(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction10x.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction10x.java
deleted file mode 100644
index 04804514..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction10x.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction10x;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction10x extends SmalideaInstruction implements Instruction10x {
- public SmalideaInstruction10x(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction11n.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction11n.java
deleted file mode 100644
index 1b185dd8..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction11n.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction11n;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction11n extends SmalideaInstruction implements Instruction11n {
- public SmalideaInstruction11n(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction11x.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction11x.java
deleted file mode 100644
index 7e8fbf4d..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction11x.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction11x;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction11x extends SmalideaInstruction implements Instruction11x {
- public SmalideaInstruction11x(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction12x.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction12x.java
deleted file mode 100644
index c6cba0a7..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction12x.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction12x;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction12x extends SmalideaInstruction implements Instruction12x {
- public SmalideaInstruction12x(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction20t.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction20t.java
deleted file mode 100644
index 1c0a9216..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction20t.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction20t;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction20t extends SmalideaInstruction implements Instruction20t {
- public SmalideaInstruction20t(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21c.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21c.java
deleted file mode 100644
index f2ac6f1a..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21c.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction21c;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction21c extends SmalideaInstruction implements Instruction21c {
- public SmalideaInstruction21c(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21ih.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21ih.java
deleted file mode 100644
index ce5f598f..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21ih.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction21ih;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction21ih extends SmalideaInstruction implements Instruction21ih {
- public SmalideaInstruction21ih(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-
- @Override public short getHatLiteral() {
- return (short)(getNarrowLiteral() >>> 16);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21lh.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21lh.java
deleted file mode 100644
index 3ef08505..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21lh.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction21lh;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction21lh extends SmalideaInstruction implements Instruction21lh {
- public SmalideaInstruction21lh(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-
- @Override public short getHatLiteral() {
- return (short)(getWideLiteral() >>> 48);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21s.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21s.java
deleted file mode 100644
index 5ae75060..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21s.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction21s;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction21s extends SmalideaInstruction implements Instruction21s {
- public SmalideaInstruction21s(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21t.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21t.java
deleted file mode 100644
index 11e17564..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction21t.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction21t;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction21t extends SmalideaInstruction implements Instruction21t {
- public SmalideaInstruction21t(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22b.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22b.java
deleted file mode 100644
index f1360467..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22b.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction22b;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction22b extends SmalideaInstruction implements Instruction22b {
- public SmalideaInstruction22b(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22c.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22c.java
deleted file mode 100644
index 4d7dacbe..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22c.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction22c;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction22c extends SmalideaInstruction implements Instruction22c {
- public SmalideaInstruction22c(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22s.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22s.java
deleted file mode 100644
index 81897688..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22s.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction22s;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction22s extends SmalideaInstruction implements Instruction22s {
- public SmalideaInstruction22s(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22t.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22t.java
deleted file mode 100644
index 8f4811d9..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22t.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction22t;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction22t extends SmalideaInstruction implements Instruction22t {
- public SmalideaInstruction22t(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22x.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22x.java
deleted file mode 100644
index 5cc8b004..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction22x.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction22x;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction22x extends SmalideaInstruction implements Instruction22x {
- public SmalideaInstruction22x(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction23x.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction23x.java
deleted file mode 100644
index 3cc60d89..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction23x.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction23x;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction23x extends SmalideaInstruction implements Instruction23x {
- public SmalideaInstruction23x(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction30t.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction30t.java
deleted file mode 100644
index 324fc773..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction30t.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction30t;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction30t extends SmalideaInstruction implements Instruction30t {
- public SmalideaInstruction30t(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction31c.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction31c.java
deleted file mode 100644
index ffea2175..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction31c.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction31c;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction31c extends SmalideaInstruction implements Instruction31c {
- public SmalideaInstruction31c(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction31i.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction31i.java
deleted file mode 100644
index 0fef6674..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction31i.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction31i;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction31i extends SmalideaInstruction implements Instruction31i {
- public SmalideaInstruction31i(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction31t.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction31t.java
deleted file mode 100644
index 142fd446..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction31t.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction31t;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction31t extends SmalideaInstruction implements Instruction31t {
- public SmalideaInstruction31t(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction32x.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction32x.java
deleted file mode 100644
index 1ac27deb..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction32x.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction32x;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction32x extends SmalideaInstruction implements Instruction32x {
- public SmalideaInstruction32x(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction35c.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction35c.java
deleted file mode 100644
index a3ddcce0..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction35c.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction35c;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction35c extends SmalideaInstruction implements Instruction35c {
- public SmalideaInstruction35c(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-
- @Override public int getRegisterC() {
- return psiInstruction.getRegister(0);
- }
-
- @Override public int getRegisterD() {
- return psiInstruction.getRegister(1);
- }
-
- @Override public int getRegisterE() {
- return psiInstruction.getRegister(2);
- }
-
- @Override public int getRegisterF() {
- return psiInstruction.getRegister(3);
- }
-
- @Override public int getRegisterG() {
- return psiInstruction.getRegister(4);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction3rc.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction3rc.java
deleted file mode 100644
index 509e6b75..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction3rc.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction3rc;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction3rc extends SmalideaInstruction implements Instruction3rc {
- public SmalideaInstruction3rc(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-
- @Override public int getStartRegister() {
- return psiInstruction.getRegister(0);
- }
-
- @Override public int getRegisterCount() {
- return psiInstruction.getRegister(1) - getStartRegister() + 1;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction51l.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction51l.java
deleted file mode 100644
index 3b58628b..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaInstruction51l.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import org.jf.dexlib2.iface.instruction.formats.Instruction51l;
-import org.jf.smalidea.psi.impl.SmaliInstruction;
-
-import javax.annotation.Nonnull;
-
-public class SmalideaInstruction51l extends SmalideaInstruction implements Instruction51l {
- public SmalideaInstruction51l(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaPackedSwitchPayload.java b/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaPackedSwitchPayload.java
deleted file mode 100644
index 6056da37..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/dexlib/instruction/SmalideaPackedSwitchPayload.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.dexlib.instruction;
-
-import com.google.common.collect.Lists;
-import org.jf.dexlib2.Opcode;
-import org.jf.dexlib2.iface.instruction.SwitchElement;
-import org.jf.dexlib2.iface.instruction.formats.PackedSwitchPayload;
-import org.jf.smalidea.psi.impl.*;
-import org.jf.smalidea.util.InstructionUtils;
-
-import javax.annotation.Nonnull;
-import java.util.List;
-
-public class SmalideaPackedSwitchPayload extends SmalideaInstruction implements PackedSwitchPayload {
- public SmalideaPackedSwitchPayload(@Nonnull SmaliInstruction instruction) {
- super(instruction);
- }
-
- @Nonnull @Override public List extends SwitchElement> getSwitchElements() {
- final SmaliLiteral startKey = psiInstruction.getPackedSwitchStartKey();
- assert startKey != null;
- List elements = psiInstruction.getPackedSwitchElements();
-
- SmaliMethod smaliMethod = psiInstruction.getParentMethod();
- SmaliInstruction packedSwitchInstruction = InstructionUtils.findFirstInstructionWithTarget(
- smaliMethod, Opcode.PACKED_SWITCH, psiInstruction.getOffset());
- final int baseOffset;
-
- if (packedSwitchInstruction == null) {
- baseOffset = 0;
- } else {
- baseOffset = packedSwitchInstruction.getOffset();
- }
-
- List newElements = Lists.newArrayList();
- // TODO: check for integer wraparound (how does art/dalvik handle that?)
- int initialKey = (int)startKey.getIntegralValue();
- for (int i=0; i getSwitchElements() {
- List elements = psiInstruction.getSparseSwitchElements();
-
- SmaliMethod smaliMethod = psiInstruction.getParentMethod();
- SmaliInstruction sparseSwitchInstruction = InstructionUtils.findFirstInstructionWithTarget(
- smaliMethod, Opcode.SPARSE_SWITCH, psiInstruction.getOffset());
- final int baseOffset;
-
- if (sparseSwitchInstruction == null) {
- baseOffset = 0;
- } else {
- baseOffset = sparseSwitchInstruction.getOffset();
- }
-
- return Lists.transform(elements, new Function() {
- @Override public SwitchElement apply(final SmaliSparseSwitchElement element) {
- return new SwitchElement() {
- @Override public int getKey() {
- return (int)element.getKey().getIntegralValue();
- }
-
- @Override public int getOffset() {
- SmaliLabelReference labelReference = element.getTarget();
- if (labelReference == null) {
- return 0;
- }
-
- SmaliLabel label = labelReference.resolve();
- if (label == null) {
- return 0;
- }
-
- return (label.getOffset() - baseOffset) / 2;
- }
- };
- }
- });
- }
-
- @Override public int getCodeUnits() {
- return psiInstruction.getInstructionSize()/2;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/errorReporting/ErrorReporter.java b/smalidea/src/main/java/org/jf/smalidea/errorReporting/ErrorReporter.java
deleted file mode 100644
index 92aef72b..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/errorReporting/ErrorReporter.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * 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 org.jf.smalidea.errorReporting;
-
-import com.intellij.diagnostic.IdeErrorsDialog;
-import com.intellij.diagnostic.LogMessageEx;
-import com.intellij.diagnostic.ReportMessages;
-import com.intellij.errorreport.bean.ErrorBean;
-import com.intellij.ide.DataManager;
-import com.intellij.ide.plugins.IdeaPluginDescriptor;
-import com.intellij.ide.plugins.PluginManager;
-import com.intellij.idea.IdeaLogger;
-import com.intellij.notification.NotificationListener;
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
-import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
-import com.intellij.openapi.diagnostic.SubmittedReportInfo;
-import com.intellij.openapi.extensions.PluginId;
-import com.intellij.openapi.progress.EmptyProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.util.Consumer;
-
-import java.awt.*;
-import java.util.Map;
-
-/**
- * Sends crash reports to Github.
- *
- * Based on the go-lang plugin's error reporter
- * (https://github.com/dlsniper/google-go-lang-idea-plugin/commit/c451006cc9fc926ca347189951baa94f4032c5c4)
- */
-public class ErrorReporter extends ErrorReportSubmitter {
-
- @Override
- public String getReportActionText() {
- return "Report as issue on smali's github repo";
- }
-
- @Override
- public boolean submit(IdeaLoggingEvent[] events, String additionalInfo, Component parentComponent,
- final Consumer consumer) {
- IdeaLoggingEvent event = events[0];
- ErrorBean bean = new ErrorBean(event.getThrowable(), IdeaLogger.ourLastActionId);
-
- final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent);
-
- bean.setDescription(additionalInfo);
- bean.setMessage(event.getMessage());
-
- Throwable throwable = event.getThrowable();
- if (throwable != null) {
- final PluginId pluginId = IdeErrorsDialog.findPluginId(throwable);
- if (pluginId != null) {
- final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
- if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
- bean.setPluginName(ideaPluginDescriptor.getName());
- bean.setPluginVersion(ideaPluginDescriptor.getVersion());
- }
- }
- }
-
- Object data = event.getData();
-
- if (data instanceof LogMessageEx) {
- bean.setAttachments(((LogMessageEx)data).getAttachments());
- }
-
- Map reportValues = ITNProxy.createParameters(bean);
-
- final Project project = CommonDataKeys.PROJECT.getData(dataContext);
-
- Consumer successCallback = new Consumer() {
- @Override
- public void consume(String token) {
- final SubmittedReportInfo reportInfo = new SubmittedReportInfo(
- null, "Issue " + token, SubmittedReportInfo.SubmissionStatus.NEW_ISSUE);
- consumer.consume(reportInfo);
-
- ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT,
- "Submitted",
- NotificationType.INFORMATION,
- null).setImportant(false).notify(project);
- }
- };
-
- Consumer errorCallback = new Consumer() {
- @Override
- public void consume(Exception e) {
- String message = String.format("There was an error while creating a GitHub issue: %s " +
- "Please consider manually creating an issue on the " +
- "Smali Issue Tracker",
- e.getMessage());
- ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT,
- message,
- NotificationType.ERROR,
- NotificationListener.URL_OPENING_LISTENER).setImportant(false).notify(project);
- }
- };
-
- GithubFeedbackTask task = new GithubFeedbackTask(project, "Submitting error report", true, reportValues,
- successCallback, errorCallback);
-
- if (project == null) {
- task.run(new EmptyProgressIndicator());
- } else {
- ProgressManager.getInstance().run(task);
- }
- return true;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/errorReporting/GithubFeedbackTask.java b/smalidea/src/main/java/org/jf/smalidea/errorReporting/GithubFeedbackTask.java
deleted file mode 100644
index ab54dc6b..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/errorReporting/GithubFeedbackTask.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * 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 org.jf.smalidea.errorReporting;
-
-import com.google.common.io.CharStreams;
-import com.google.gson.Gson;
-import com.intellij.ide.plugins.IdeaPluginDescriptorImpl;
-import com.intellij.ide.plugins.PluginManager;
-import com.intellij.openapi.extensions.PluginId;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.Task;
-import com.intellij.openapi.project.Project;
-import com.intellij.util.Consumer;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class GithubFeedbackTask extends Task.Backgroundable {
- private final Consumer myCallback;
- private final Consumer myErrorCallback;
- private final Map myParams;
-
- public GithubFeedbackTask(@Nullable Project project,
- @NotNull String title,
- boolean canBeCancelled,
- Map params,
- final Consumer callback,
- final Consumer errorCallback) {
- super(project, title, canBeCancelled);
-
- myParams = params;
- myCallback = callback;
- myErrorCallback = errorCallback;
- }
-
- @Override
- public void run(@NotNull ProgressIndicator indicator) {
- indicator.setIndeterminate(true);
- try {
- String token = sendFeedback(myParams);
- myCallback.consume(token);
- }
- catch (Exception e) {
- myErrorCallback.consume(e);
- }
- }
-
- private static String getToken() {
- InputStream stream = GithubFeedbackTask.class.getClassLoader().getResourceAsStream("token");
- if (stream == null) {
- return null;
- }
- try {
- return CharStreams.toString(new InputStreamReader(stream, "UTF-8"));
- } catch (IOException ex) {
- return null;
- }
- }
-
- public static String sendFeedback(Map environmentDetails) throws IOException {
- String url = "https://api.github.com/repos/JesusFreke/smalidea-issues/issues";
- String userAgent = "smalidea plugin";
-
- IdeaPluginDescriptorImpl pluginDescriptor =
- (IdeaPluginDescriptorImpl) PluginManager.getPlugin(PluginId.getId("org.jf.smalidea"));
-
- if (pluginDescriptor != null) {
- String name = pluginDescriptor.getName();
- String version = pluginDescriptor.getVersion();
- userAgent = name + " (" + version + ")";
- }
-
- HttpURLConnection httpURLConnection = connect(url);
- httpURLConnection.setDoOutput(true);
- httpURLConnection.setRequestMethod("POST");
- httpURLConnection.setRequestProperty("User-Agent", userAgent);
- httpURLConnection.setRequestProperty("Content-Type", "application/json");
-
- String token = getToken();
- if (token != null) {
- httpURLConnection.setRequestProperty("Authorization", "token " + token);
- }
- OutputStream outputStream = httpURLConnection.getOutputStream();
-
- try {
- outputStream.write(convertToGithubIssueFormat(environmentDetails));
- } finally {
- outputStream.close();
- }
-
- int responseCode = httpURLConnection.getResponseCode();
- if (responseCode != 201) {
- throw new RuntimeException("Expected HTTP_CREATED (201), obtained " + responseCode);
- }
-
- return Long.toString(System.currentTimeMillis());
- }
-
- private static byte[] convertToGithubIssueFormat(Map environmentDetails) {
- LinkedHashMap result = new LinkedHashMap(5);
- result.put("title", "[auto-generated] Crash in plugin");
- result.put("body", generateGithubIssueBody(environmentDetails));
-
- return ((new Gson()).toJson(result)).getBytes(Charset.forName("UTF-8"));
- }
-
- private static String generateGithubIssueBody(Map body) {
- String errorDescription = body.get("error.description");
- if (errorDescription == null) {
- errorDescription = "";
- }
- body.remove("error.description");
-
- String errorMessage = body.get("error.message");
- if (errorMessage == null || errorMessage.isEmpty()) {
- errorMessage = "invalid error";
- }
- body.remove("error.message");
-
- String stackTrace = body.get("error.stacktrace");
- if (stackTrace == null || stackTrace.isEmpty()) {
- stackTrace = "invalid stacktrace";
- }
- body.remove("error.stacktrace");
-
- String result = "";
-
- if (!errorDescription.isEmpty()) {
- result += errorDescription + "\n\n";
- }
-
- for (Map.Entry entry : body.entrySet()) {
- result += entry.getKey() + ": " + entry.getValue() + "\n";
- }
-
- result += "\n```\n" + stackTrace + "\n```\n";
-
- result += "\n```\n" + errorMessage + "\n```";
-
- return result;
- }
-
- private static HttpURLConnection connect(String url) throws IOException {
- HttpURLConnection connection = (HttpURLConnection) ((new URL(url)).openConnection());
- connection.setConnectTimeout(5000);
- connection.setReadTimeout(5000);
- return connection;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/errorReporting/ITNProxy.java b/smalidea/src/main/java/org/jf/smalidea/errorReporting/ITNProxy.java
deleted file mode 100644
index 5bf93e32..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/errorReporting/ITNProxy.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2000-2014 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 org.jf.smalidea.errorReporting;
-
-import com.intellij.errorreport.bean.ErrorBean;
-import com.intellij.idea.IdeaLogger;
-import com.intellij.openapi.application.Application;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ApplicationNamesInfo;
-import com.intellij.openapi.application.ex.ApplicationInfoEx;
-import com.intellij.openapi.diagnostic.Attachment;
-import com.intellij.openapi.updateSettings.impl.UpdateSettings;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.util.SystemProperties;
-import com.intellij.util.containers.ContainerUtil;
-
-import java.util.Calendar;
-import java.util.Map;
-
-/**
- * @author stathik
- * @since Aug 4, 2003
- */
-public class ITNProxy {
-
- public static Map createParameters(ErrorBean error) {
- Map params = ContainerUtil.newLinkedHashMap(40);
-
- params.put("protocol.version", "1");
-
- params.put("os.name", SystemProperties.getOsName());
- params.put("java.version", SystemProperties.getJavaVersion());
- params.put("java.vm.vendor", SystemProperties.getJavaVmVendor());
-
- ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
- ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
- Application application = ApplicationManager.getApplication();
- params.put("app.name", namesInfo.getProductName());
- params.put("app.name.full", namesInfo.getFullProductName());
- params.put("app.name.version", appInfo.getVersionName());
- params.put("app.eap", Boolean.toString(appInfo.isEAP()));
- params.put("app.internal", Boolean.toString(application.isInternal()));
- params.put("app.build", appInfo.getBuild().asString());
- params.put("app.version.major", appInfo.getMajorVersion());
- params.put("app.version.minor", appInfo.getMinorVersion());
- params.put("app.build.date", format(appInfo.getBuildDate()));
- params.put("app.build.date.release", format(appInfo.getMajorReleaseBuildDate()));
- params.put("app.compilation.timestamp", IdeaLogger.getOurCompilationTimestamp());
-
- UpdateSettings updateSettings = UpdateSettings.getInstance();
- params.put("update.channel.status", updateSettings.getSelectedChannelStatus().getCode());
- params.put("update.ignored.builds", StringUtil.join(updateSettings.getIgnoredBuildNumbers(), ","));
-
- params.put("plugin.name", error.getPluginName());
- params.put("plugin.version", error.getPluginVersion());
-
- params.put("last.action", error.getLastAction());
- params.put("previous.exception", error.getPreviousException() == null ? null : Integer.toString(error.getPreviousException()));
-
- params.put("error.message", error.getMessage());
- params.put("error.stacktrace", error.getStackTrace());
- params.put("error.description", error.getDescription());
-
- params.put("assignee.id", error.getAssigneeId() == null ? null : Integer.toString(error.getAssigneeId()));
-
- for (Attachment attachment : error.getAttachments()) {
- params.put("attachment.name", attachment.getName());
- params.put("attachment.value", attachment.getEncodedBytes());
- }
-
- return params;
- }
-
- private static String format(Calendar calendar) {
- return calendar == null ? null : Long.toString(calendar.getTime().getTime());
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliClassReferenceSearcher.java b/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliClassReferenceSearcher.java
deleted file mode 100644
index 63e4d6fe..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliClassReferenceSearcher.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.findUsages;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.QueryExecutorBase;
-import com.intellij.openapi.progress.EmptyProgressIndicator;
-import com.intellij.openapi.util.Computable;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiReference;
-import com.intellij.psi.impl.search.LowLevelSearchUtil;
-import com.intellij.psi.search.*;
-import com.intellij.psi.search.searches.ReferencesSearch;
-import com.intellij.psi.search.searches.ReferencesSearch.SearchParameters;
-import com.intellij.util.Processor;
-import com.intellij.util.text.StringSearcher;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.util.NameUtils;
-
-public class SmaliClassReferenceSearcher extends QueryExecutorBase {
- @Override public void processQuery(final SearchParameters queryParameters, final Processor consumer) {
- final PsiElement element = queryParameters.getElementToSearch();
- if (!(element instanceof PsiClass)) {
- return;
- }
-
- String smaliType = ApplicationManager.getApplication().runReadAction(
- new Computable() {
- @Override public String compute() {
- String qualifiedName = ((PsiClass)element).getQualifiedName();
- if (qualifiedName != null) {
- return NameUtils.javaToSmaliType((PsiClass)element);
- }
- return null;
- }
- });
- if (smaliType == null) {
- return;
- }
-
- final StringSearcher stringSearcher = new StringSearcher(smaliType, true, true, false, false);
-
- final SingleTargetRequestResultProcessor processor = new SingleTargetRequestResultProcessor(element);
-
- SearchScope querySearchScope = ApplicationManager.getApplication().runReadAction(
- new Computable() {
- @Override public SearchScope compute() {
- return queryParameters.getEffectiveSearchScope();
- }
- });
-
- if (querySearchScope instanceof LocalSearchScope) {
- for (final PsiElement scopeElement : ((LocalSearchScope)querySearchScope).getScope()) {
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- LowLevelSearchUtil.processElementsContainingWordInElement(
- new TextOccurenceProcessor() {
- @Override public boolean execute(
- @NotNull PsiElement element, int offsetInElement) {
- return processor.processTextOccurrence(element, offsetInElement, consumer);
- }
- },
- scopeElement, stringSearcher, true, new EmptyProgressIndicator());
- }
- });
- }
- } else if (querySearchScope instanceof GlobalSearchScope) {
- PsiSearchHelper helper = PsiSearchHelper.SERVICE.getInstance(element.getProject());
- // TODO: limit search scope to only smali files. See, e.g. AnnotatedPackagesSearcher.PackageInfoFilesOnly
- helper.processAllFilesWithWord(smaliType, (GlobalSearchScope)querySearchScope,
- new Processor() {
- @Override
- public boolean process(PsiFile file) {
- LowLevelSearchUtil.processElementsContainingWordInElement(
- new TextOccurenceProcessor() {
- @Override public boolean execute(
- @NotNull PsiElement element, int offsetInElement) {
- return processor.processTextOccurrence(element, offsetInElement, consumer);
- }
- },
- file, stringSearcher, true, new EmptyProgressIndicator());
- return true;
- }
- }, true);
- } else {
- assert false;
- return;
- }
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliFindUsagesProvider.java b/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliFindUsagesProvider.java
deleted file mode 100644
index 335bce27..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliFindUsagesProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.findUsages;
-
-import com.intellij.lang.cacheBuilder.WordsScanner;
-import com.intellij.lang.java.JavaFindUsagesProvider;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public class SmaliFindUsagesProvider extends JavaFindUsagesProvider {
- @Override public boolean canFindUsagesFor(@NotNull PsiElement element) {
- return element instanceof PsiClass;
- }
-
- @Nullable @Override public WordsScanner getWordsScanner() {
- return new SmaliWordScanner();
- }
-
-
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliUsageTargetProvider.java b/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliUsageTargetProvider.java
deleted file mode 100644
index e87782b6..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliUsageTargetProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.findUsages;
-
-import com.intellij.codeInsight.TargetElementUtilBase;
-import com.intellij.find.findUsages.PsiElement2UsageTargetAdapter;
-import com.intellij.lang.ASTNode;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.usages.UsageTarget;
-import com.intellij.usages.UsageTargetProvider;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.SmaliTokens;
-import org.jf.smalidea.psi.impl.SmaliMemberName;
-
-/**
- * A usage target provider for smali member names consisting of primitive types.
- *
- * For member names like IIII, the default logic to find the usage target doesn't work, due to the member
- * name being split up into multiple leaf tokens.
- */
-public class SmaliUsageTargetProvider implements UsageTargetProvider {
- @Nullable @Override public UsageTarget[] getTargets(Editor editor, PsiFile file) {
- PsiElement element = file.findElementAt(
- TargetElementUtilBase.adjustOffset(file, editor.getDocument(), editor.getCaretModel().getOffset()));
- if (element == null) {
- return null;
- }
- return getTargets(element);
- }
-
- @Nullable @Override public UsageTarget[] getTargets(PsiElement element) {
- ASTNode node = element.getNode();
- if (node == null) {
- return null;
- }
-
- if (node.getElementType() == SmaliTokens.PARAM_LIST_OR_ID_PRIMITIVE_TYPE) {
- PsiElement parent = element.getParent();
- if (parent instanceof SmaliMemberName) {
- return new UsageTarget[] { new PsiElement2UsageTargetAdapter(parent.getParent()) };
- }
- }
- return null;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliUsageTypeProvider.java b/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliUsageTypeProvider.java
deleted file mode 100644
index ad869421..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliUsageTypeProvider.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.findUsages;
-
-import com.intellij.psi.*;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.usages.impl.rules.UsageType;
-import com.intellij.usages.impl.rules.UsageTypeProvider;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.dexlib2.Opcode;
-import org.jf.smalidea.SmaliTokens;
-import org.jf.smalidea.psi.impl.*;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-public class SmaliUsageTypeProvider implements UsageTypeProvider {
-
- static final UsageType CLASS_DECLARATION = new UsageType("Class declaration");
- static final UsageType VERIFICATION_ERROR = new UsageType("Usage in verification error");
- static final UsageType FIELD_TYPE_REFERENCE = new UsageType("Usage as field type in a field reference");
- static final UsageType FIELD_DECLARING_TYPE_REFERENCE = new UsageType("Usage as a declaring type in a field reference");
- static final UsageType METHOD_RETURN_TYPE_REFERENCE = new UsageType("Usage as return type in a method reference");
- static final UsageType METHOD_PARAM_REFERENCE = new UsageType("Usage as parameter in a method reference");
- static final UsageType METHOD_DECLARING_TYPE_REFERENCE = new UsageType("Usage as a declaring type in a method reference");
- static final UsageType LITERAL = new UsageType("Usage as a literal");
-
- @Nullable @Override public UsageType getUsageType(PsiElement element) {
- if (element instanceof PsiReference) {
- PsiElement referenced = ((PsiReference) element).resolve();
- if (referenced != null) {
- if (referenced instanceof PsiClass) {
- return findClassUsageType(element);
- } else if (referenced instanceof PsiField) {
- return findFieldUsageType(element);
- } else if (referenced instanceof PsiMethod) {
- return findMethodUsageType(element);
- }
- }
- }
- return UsageType.UNCLASSIFIED;
- }
-
- private final Set newArrayInstructions = EnumSet.of(Opcode.FILLED_NEW_ARRAY, Opcode.NEW_ARRAY,
- Opcode.FILLED_NEW_ARRAY_RANGE);
-
- private final Set fieldReadInstructions = EnumSet.of(Opcode.IGET, Opcode.IGET_BOOLEAN, Opcode.IGET_BYTE,
- Opcode.IGET_CHAR, Opcode.IGET_OBJECT, Opcode.IGET_OBJECT_VOLATILE, Opcode.IGET_SHORT, Opcode.IGET_VOLATILE,
- Opcode.IGET_WIDE, Opcode.IGET_WIDE_VOLATILE, Opcode.SGET, Opcode.SGET_BOOLEAN, Opcode.SGET_BYTE,
- Opcode.SGET_CHAR, Opcode.SGET_OBJECT, Opcode.SGET_OBJECT_VOLATILE, Opcode.SGET_SHORT, Opcode.SGET_VOLATILE,
- Opcode.SGET_WIDE, Opcode.SGET_WIDE_VOLATILE);
-
- private final Set fieldWriteInstructions = EnumSet.of(Opcode.IPUT, Opcode.IPUT_BOOLEAN, Opcode.IPUT_BYTE,
- Opcode.IPUT_CHAR, Opcode.IPUT_OBJECT, Opcode.IPUT_OBJECT_VOLATILE, Opcode.IPUT_SHORT, Opcode.IPUT_VOLATILE,
- Opcode.IPUT_WIDE, Opcode.IPUT_WIDE_VOLATILE, Opcode.SPUT, Opcode.SPUT_BOOLEAN, Opcode.SPUT_BYTE,
- Opcode.SPUT_CHAR, Opcode.SPUT_OBJECT, Opcode.SPUT_OBJECT_VOLATILE, Opcode.SPUT_SHORT, Opcode.SPUT_VOLATILE,
- Opcode.SPUT_WIDE, Opcode.SPUT_WIDE_VOLATILE);
-
- @Nullable
- private UsageType findClassUsageType(@NotNull PsiElement element) {
- PsiElement originalElement = element;
-
- while (element != null) {
- if (element instanceof SmaliFieldReference) {
- PsiElement prev = originalElement.getPrevSibling();
- while (prev != null) {
- // if the element is to the right of a colon, then it is the field type, otherwise it is
- // the declaring class
- if (prev.getNode().getElementType() == SmaliTokens.COLON) {
- return FIELD_TYPE_REFERENCE;
- }
- prev = prev.getPrevSibling();
- }
- return FIELD_DECLARING_TYPE_REFERENCE;
- } else if (element instanceof SmaliMethodReferenceParamList) {
- return METHOD_PARAM_REFERENCE;
- } else if (element instanceof SmaliMethodReference) {
- PsiElement prev = originalElement.getPrevSibling();
- while (prev != null) {
- IElementType elementType = prev.getNode().getElementType();
- // if the element is to the right of a close paren, then it is the return type,
- // otherwise it is the declaring class. Any parameter type will be taken care of by the previous
- // "if" for SmaliMethodReferenceParamList
- if (elementType == SmaliTokens.CLOSE_PAREN) {
- return METHOD_RETURN_TYPE_REFERENCE;
- }
- prev = prev.getPrevSibling();
- }
- return METHOD_DECLARING_TYPE_REFERENCE;
- } else if (element instanceof SmaliInstruction) {
- Opcode opcode = ((SmaliInstruction) element).getOpcode();
- if (opcode == Opcode.INSTANCE_OF) {
- return UsageType.CLASS_INSTANCE_OF;
- } else if (opcode == Opcode.CHECK_CAST) {
- return UsageType.CLASS_CAST_TO;
- } else if (newArrayInstructions.contains(opcode)) {
- return UsageType.CLASS_NEW_ARRAY;
- } else if (opcode == Opcode.NEW_INSTANCE) {
- return UsageType.CLASS_NEW_OPERATOR;
- } else if (opcode == Opcode.CONST_CLASS) {
- return UsageType.CLASS_CLASS_OBJECT_ACCESS;
- } else if (opcode == Opcode.THROW_VERIFICATION_ERROR) {
- return VERIFICATION_ERROR;
- }
- } else if (element instanceof SmaliSuperStatement || element instanceof SmaliImplementsStatement) {
- return UsageType.CLASS_EXTENDS_IMPLEMENTS_LIST;
- } else if (element instanceof SmaliClassStatement) {
- return CLASS_DECLARATION;
- } else if (element instanceof SmaliMethodParamList) {
- return UsageType.CLASS_METHOD_PARAMETER_DECLARATION;
- } else if (element instanceof SmaliMethodPrototype) {
- return UsageType.CLASS_METHOD_RETURN_TYPE;
- } else if (element instanceof SmaliField) {
- return UsageType.CLASS_FIELD_DECLARATION;
- } else if (element instanceof SmaliCatchStatement) {
- return UsageType.CLASS_CATCH_CLAUSE_PARAMETER_DECLARATION;
- } else if (element instanceof SmaliLocalDebugStatement) {
- return UsageType.CLASS_LOCAL_VAR_DECLARATION;
- } else if (element instanceof SmaliAnnotation) {
- return UsageType.ANNOTATION;
- } else if (element instanceof SmaliLiteral) {
- return LITERAL;
- }
- element = element.getParent();
- }
- return UsageType.UNCLASSIFIED;
- }
-
- @Nullable
- private UsageType findFieldUsageType(@NotNull PsiElement element) {
- PsiElement originalElement = element;
-
- while (element != null) {
- element = element.getParent();
-
- if (element instanceof SmaliInstruction) {
- Opcode opcode = ((SmaliInstruction) element).getOpcode();
- if (fieldReadInstructions.contains(opcode)) {
- return UsageType.READ;
- } else if (fieldWriteInstructions.contains(opcode)) {
- return UsageType.WRITE;
- } else if (opcode == Opcode.THROW_VERIFICATION_ERROR) {
- return VERIFICATION_ERROR;
- }
- } if (element instanceof SmaliLiteral) {
- return LITERAL;
- }
- }
- return UsageType.UNCLASSIFIED;
- }
-
- @Nullable
- private UsageType findMethodUsageType(@NotNull PsiElement element) {
- PsiElement originalElement = element;
-
- while (element != null) {
- element = element.getParent();
-
- if (element instanceof SmaliInstruction) {
- Opcode opcode = ((SmaliInstruction) element).getOpcode();
- if (opcode == Opcode.THROW_VERIFICATION_ERROR) {
- return VERIFICATION_ERROR;
- }
- } if (element instanceof SmaliLiteral) {
- return LITERAL;
- }
- }
- return UsageType.UNCLASSIFIED;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliWordScanner.java b/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliWordScanner.java
deleted file mode 100644
index 56bbdafb..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/findUsages/SmaliWordScanner.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.findUsages;
-
-import com.intellij.lang.cacheBuilder.WordOccurrence;
-import com.intellij.lang.cacheBuilder.WordOccurrence.Kind;
-import com.intellij.lang.cacheBuilder.WordsScanner;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.tree.TokenSet;
-import com.intellij.util.Processor;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.SmaliLexer;
-import org.jf.smalidea.SmaliTokens;
-
-public class SmaliWordScanner implements WordsScanner {
-
- private static final TokenSet MEMBER_NAME_TOKENS = TokenSet.create(
- SmaliTokens.MEMBER_NAME,
- SmaliTokens.SIMPLE_NAME,
- SmaliTokens.ACCESS_SPEC,
- SmaliTokens.VERIFICATION_ERROR_TYPE,
- SmaliTokens.POSITIVE_INTEGER_LITERAL,
- SmaliTokens.NEGATIVE_INTEGER_LITERAL,
- SmaliTokens.FLOAT_LITERAL_OR_ID,
- SmaliTokens.DOUBLE_LITERAL_OR_ID,
- SmaliTokens.BOOL_LITERAL,
- SmaliTokens.NULL_LITERAL,
- SmaliTokens.REGISTER,
- SmaliTokens.PRIMITIVE_TYPE,
- SmaliTokens.VOID_TYPE,
- SmaliTokens.ANNOTATION_VISIBILITY,
- SmaliTokens.INSTRUCTION_FORMAT10t,
- SmaliTokens.INSTRUCTION_FORMAT10x,
- SmaliTokens.INSTRUCTION_FORMAT10x_ODEX,
- SmaliTokens.INSTRUCTION_FORMAT11x,
- SmaliTokens.INSTRUCTION_FORMAT12x_OR_ID,
- SmaliTokens.INSTRUCTION_FORMAT21c_FIELD,
- SmaliTokens.INSTRUCTION_FORMAT21c_FIELD_ODEX,
- SmaliTokens.INSTRUCTION_FORMAT21c_STRING,
- SmaliTokens.INSTRUCTION_FORMAT21c_TYPE,
- SmaliTokens.INSTRUCTION_FORMAT21t,
- SmaliTokens.INSTRUCTION_FORMAT22c_FIELD,
- SmaliTokens.INSTRUCTION_FORMAT22c_FIELD_ODEX,
- SmaliTokens.INSTRUCTION_FORMAT22c_TYPE,
- SmaliTokens.INSTRUCTION_FORMAT22cs_FIELD,
- SmaliTokens.INSTRUCTION_FORMAT22s_OR_ID,
- SmaliTokens.INSTRUCTION_FORMAT22t,
- SmaliTokens.INSTRUCTION_FORMAT23x,
- SmaliTokens.INSTRUCTION_FORMAT31i_OR_ID,
- SmaliTokens.INSTRUCTION_FORMAT31t,
- SmaliTokens.INSTRUCTION_FORMAT35c_METHOD,
- SmaliTokens.INSTRUCTION_FORMAT35c_METHOD_ODEX,
- SmaliTokens.INSTRUCTION_FORMAT35c_TYPE,
- SmaliTokens.INSTRUCTION_FORMAT35mi_METHOD,
- SmaliTokens.INSTRUCTION_FORMAT35ms_METHOD,
- SmaliTokens.INSTRUCTION_FORMAT51l);
-
- @Override public void processWords(CharSequence fileText, Processor processor) {
- SmaliLexer lexer = new SmaliLexer();
- lexer.start(fileText);
-
- IElementType type = lexer.getTokenType();
- while (type != null) {
- if (type == SmaliTokens.CLASS_DESCRIPTOR) {
- processClassDescriptor(fileText, lexer.getTokenStart(), lexer.getTokenEnd(), processor);
- } else if (MEMBER_NAME_TOKENS.contains(type)) {
- processor.process(new WordOccurrence(fileText, lexer.getTokenStart(), lexer.getTokenEnd(), Kind.CODE));
- } else if (type == SmaliTokens.PARAM_LIST_OR_ID_PRIMITIVE_TYPE) {
- int tokenStart = lexer.getTokenStart();
- while (type == SmaliTokens.PARAM_LIST_OR_ID_PRIMITIVE_TYPE) {
- lexer.advance();
- type = lexer.getTokenType();
- }
- int tokenEnd = lexer.getTokenStart();
- processor.process(new WordOccurrence(fileText, tokenStart, tokenEnd, Kind.CODE));
- }
- lexer.advance();
- type = lexer.getTokenType();
- }
- }
-
- private void processClassDescriptor(CharSequence fileText, int tokenStart, int tokenEnd,
- @NotNull Processor processor) {
- CharSequence tokenText = fileText.subSequence(tokenStart, tokenEnd);
-
- assert tokenText.charAt(0) == 'L' && tokenText.charAt(tokenText.length()-1) == ';';
- processor.process(new WordOccurrence(fileText, tokenStart, tokenEnd, Kind.CODE));
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/SmaliCompositeElementFactory.java b/smalidea/src/main/java/org/jf/smalidea/psi/SmaliCompositeElementFactory.java
deleted file mode 100644
index 6d5bb105..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/SmaliCompositeElementFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi;
-
-import org.jf.smalidea.psi.impl.SmaliCompositeElement;
-
-public interface SmaliCompositeElementFactory {
- SmaliCompositeElement createElement();
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/SmaliCompositeElementType.java b/smalidea/src/main/java/org/jf/smalidea/psi/SmaliCompositeElementType.java
deleted file mode 100644
index ae5fc538..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/SmaliCompositeElementType.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi;
-
-import com.intellij.psi.tree.ICompositeElementType;
-import com.intellij.psi.tree.IElementType;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.SmaliLanguage;
-import org.jf.smalidea.psi.impl.SmaliCompositeElement;
-
-public class SmaliCompositeElementType extends IElementType implements ICompositeElementType {
- @NotNull private final SmaliCompositeElementFactory factory;
-
- public SmaliCompositeElementType(@NotNull @NonNls String debugName,
- @NotNull SmaliCompositeElementFactory factory) {
- super(debugName, SmaliLanguage.INSTANCE);
- this.factory = factory;
- }
-
- @NotNull @Override public SmaliCompositeElement createCompositeNode() {
- return factory.createElement();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/SmaliElementTypes.java b/smalidea/src/main/java/org/jf/smalidea/psi/SmaliElementTypes.java
deleted file mode 100644
index bb4bd37a..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/SmaliElementTypes.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi;
-
-import org.jf.smalidea.psi.impl.*;
-import org.jf.smalidea.psi.stub.element.*;
-
-public class SmaliElementTypes {
- public static final SmaliFileElementType FILE = SmaliFileElementType.INSTANCE;
- public static final SmaliClassElementType CLASS = SmaliClassElementType.INSTANCE;
- public static final SmaliFieldElementType FIELD = SmaliFieldElementType.INSTANCE;
- public static final SmaliMethodElementType METHOD = SmaliMethodElementType.INSTANCE;
- public static final SmaliClassStatementElementType CLASS_STATEMENT = SmaliClassStatementElementType.INSTANCE;
- public static final SmaliMethodPrototypeElementType METHOD_PROTOTYPE = SmaliMethodPrototypeElementType.INSTANCE;
- public static final SmaliMethodParamListElementType METHOD_PARAM_LIST = SmaliMethodParamListElementType.INSTANCE;
- public static final SmaliMethodParameterElementType METHOD_PARAMETER = SmaliMethodParameterElementType.INSTANCE;
- public static final SmaliAnnotationElementType ANNOTATION = SmaliAnnotationElementType.INSTANCE;
- public static final SmaliModifierListElementType MODIFIER_LIST = SmaliModifierListElementType.INSTANCE;
- public static final SmaliExtendsListElementType EXTENDS_LIST = SmaliExtendsListElementType.INSTANCE;
- public static final SmaliImplementsListElementType IMPLEMENTS_LIST = SmaliImplementsListElementType.INSTANCE;
- public static final SmaliThrowsListElementType THROWS_LIST = SmaliThrowsListElementType.INSTANCE;
-
- public static final SmaliCompositeElementType LITERAL =
- new SmaliCompositeElementType("LITERAL", SmaliLiteral.FACTORY);
- public static final SmaliCompositeElementType SUPER_STATEMENT =
- new SmaliCompositeElementType("SUPER_STATEMENT", SmaliSuperStatement.FACTORY);
- public static final SmaliCompositeElementType IMPLEMENTS_STATEMENT =
- new SmaliCompositeElementType("IMPLEMENTS_STATEMENT", SmaliImplementsStatement.FACTORY);
- public static final SmaliCompositeElementType SOURCE_STATEMENT =
- new SmaliCompositeElementType("SOURCE_STATEMENT", SmaliSourceStatement.FACTORY);
- public static final SmaliCompositeElementType REGISTERS_STATEMENT =
- new SmaliCompositeElementType("REGISTERS_STATEMENT", SmaliRegistersStatement.FACTORY);
- public static final SmaliCompositeElementType REGISTER_REFERENCE =
- new SmaliCompositeElementType("REGISTER_REFERENCE", SmaliRegisterReference.FACTORY);
- public static final SmaliCompositeElementType MEMBER_NAME =
- new SmaliCompositeElementType("MEMBER_NAME", SmaliMemberName.FACTORY);
- public static final SmaliCompositeElementType LOCAL_NAME =
- new SmaliCompositeElementType("LOCAL_NAME", SmaliLocalName.FACTORY);
- public static final SmaliCompositeElementType PARAMETER_STATEMENT =
- new SmaliCompositeElementType("PARAMETER_STATEMENT", SmaliParameterStatement.FACTORY);
- public static final SmaliCompositeElementType FIELD_INITIALIZER =
- new SmaliCompositeElementType("FIELD_INITIALIZER", SmaliFieldInitializer.FACTORY);
- public static final SmaliCompositeElementType INSTRUCTION =
- new SmaliCompositeElementType("INSTRUCTION", SmaliInstruction.FACTORY);
- public static final SmaliCompositeElementType ANNOTATION_PARAMETER_LIST =
- new SmaliCompositeElementType("ANNOTATION_PARAMETER_LIST", SmaliAnnotationParameterList.FACTORY);
- public static final SmaliCompositeElementType ANNOTATION_ELEMENT =
- new SmaliCompositeElementType("ANNOTATION_ELEMENT", SmaliAnnotationElement.FACTORY);
- public static final SmaliCompositeElementType ANNOTATION_ELEMENT_NAME =
- new SmaliCompositeElementType("ANNOTATION_ELEMENT_NAME", SmaliAnnotationElementName.FACTORY);
- public static final SmaliCompositeElementType FIELD_REFERENCE =
- new SmaliCompositeElementType("FIELD_REFERENCE", SmaliFieldReference.FACTORY);
- public static final SmaliCompositeElementType METHOD_REFERENCE =
- new SmaliCompositeElementType("METHOD_REFERENCE", SmaliMethodReference.FACTORY);
- public static final SmaliCompositeElementType METHOD_REFERENCE_PARAM_LIST =
- new SmaliCompositeElementType("METHOD_REFERENCE_PARAM_LIST", SmaliMethodReferenceParamList.FACTORY);
- public static final SmaliCompositeElementType LABEL =
- new SmaliCompositeElementType("LABEL", SmaliLabel.FACTORY);
- public static final SmaliCompositeElementType LABEL_REFERENCE =
- new SmaliCompositeElementType("LABEL_REFERENCE", SmaliLabelReference.FACTORY);
- public static final SmaliCompositeElementType LINE_DEBUG_STATEMENT =
- new SmaliCompositeElementType("LINE_DEBUG_STATEMENT", SmaliLineDebugStatement.FACTORY);
- public static final SmaliCompositeElementType LOCAL_DEBUG_STATEMENT =
- new SmaliCompositeElementType("LOCAL_DEBUG_STATEMENT", SmaliLocalDebugStatement.FACTORY);
- public static final SmaliCompositeElementType END_LOCAL_DEBUG_STATEMENT =
- new SmaliCompositeElementType("END_LOCAL_DEBUG_STATEMENT", SmaliEndLocalDebugStatement.FACTORY);
- public static final SmaliCompositeElementType RESTART_LOCAL_DEBUG_STATEMENT =
- new SmaliCompositeElementType("RESTART_LOCAL_DEBUG_STATEMENT", SmaliRestartLocalDebugStatement.FACTORY);
- public static final SmaliCompositeElementType PROLOGUE_DEBUG_STATEMENT =
- new SmaliCompositeElementType("PROLOGUE_DEBUG_STATEMENT", SmaliPrologueDebugStatement.FACTORY);
- public static final SmaliCompositeElementType EPILOGUE_DEBUG_STATEMENT =
- new SmaliCompositeElementType("EPILOGUE_DEBUG_STATEMENT", SmaliEpilogueDebugStatement.FACTORY);
- public static final SmaliCompositeElementType SOURCE_DEBUG_STATEMENT =
- new SmaliCompositeElementType("SOURCE_DEBUG_STATEMENT", SmaliSourceDebugStatement.FACTORY);
- public static final SmaliCompositeElementType PRIMITIVE_TYPE =
- new SmaliCompositeElementType("PRIMITIVE_TYPE", SmaliPrimitiveTypeElement.FACTORY);
- public static final SmaliCompositeElementType CLASS_TYPE =
- new SmaliCompositeElementType("CLASS_TYPE", SmaliClassTypeElement.FACTORY);
- public static final SmaliCompositeElementType ARRAY_TYPE =
- new SmaliCompositeElementType("ARRAY_TYPE", SmaliArrayTypeElement.FACTORY);
- public static final SmaliCompositeElementType VOID_TYPE =
- new SmaliCompositeElementType("VOID_TYPE", SmaliVoidTypeElement.FACTORY);
- public static final SmaliCompositeElementType CATCH_STATEMENT =
- new SmaliCompositeElementType("CATCH_STATEMENT", SmaliCatchStatement.FACTORY);
- public static final SmaliCompositeElementType CATCH_ALL_STATEMENT =
- new SmaliCompositeElementType("CATCH_ALL_STATEMENT", SmaliCatchAllStatement.FACTORY);
- public static final SmaliCompositeElementType PACKED_SWITCH_ELEMENT =
- new SmaliCompositeElementType("PACKED_SWITCH_ELEMENT", SmaliPackedSwitchElement.FACTORY);
- public static final SmaliCompositeElementType SPARSE_SWITCH_ELEMENT =
- new SmaliCompositeElementType("SPARSE_SWITCH_ELEMENT", SmaliSparseSwitchElement.FACTORY);
- public static final SmaliCompositeElementType ARRAY_DATA_ELEMENT =
- new SmaliCompositeElementType("ARRAY_DATA_ELEMENT", SmaliArrayDataElement.FACTORY);
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/iface/SmaliModifierListOwner.java b/smalidea/src/main/java/org/jf/smalidea/psi/iface/SmaliModifierListOwner.java
deleted file mode 100644
index 3da47c9b..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/iface/SmaliModifierListOwner.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.iface;
-
-import com.intellij.psi.PsiAnnotationOwner;
-import com.intellij.psi.PsiModifierListOwner;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.impl.SmaliAnnotation;
-import org.jf.smalidea.psi.impl.SmaliModifierList;
-
-public interface SmaliModifierListOwner extends PsiModifierListOwner, PsiAnnotationOwner {
- @NotNull @Override SmaliAnnotation[] getAnnotations();
- @NotNull @Override SmaliAnnotation[] getApplicableAnnotations();
- @Nullable @Override SmaliAnnotation findAnnotation(@NotNull @NonNls String qualifiedName);
- @NotNull @Override SmaliAnnotation addAnnotation(@NotNull @NonNls String qualifiedName);
- @Nullable @Override SmaliModifierList getModifierList();
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/LightSmaliClassTypeElement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/LightSmaliClassTypeElement.java
deleted file mode 100644
index acd9a02a..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/LightSmaliClassTypeElement.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.light.LightElement;
-import com.intellij.psi.infos.CandidateInfo;
-import com.intellij.psi.scope.PsiScopeProcessor;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.SmaliLanguage;
-import org.jf.smalidea.util.NameUtils;
-
-public class LightSmaliClassTypeElement extends LightElement
- implements PsiTypeElement, PsiReference, PsiJavaCodeReferenceElement {
- @NotNull
- private final String smaliName;
-
- public LightSmaliClassTypeElement(@NotNull PsiManager manager, @NotNull String smaliName) {
- super(manager, SmaliLanguage.INSTANCE);
- this.smaliName = smaliName;
- }
-
- @Override public String toString() {
- return "LightSmaliClassTypeElement:" + smaliName;
- }
-
- @NotNull @Override public PsiType getType() {
- return new SmaliClassType(this);
- }
-
- @Nullable @Override public LightSmaliClassTypeElement getInnermostComponentReferenceElement() {
- return this;
- }
-
- @Override public String getText() {
- return smaliName;
- }
-
- @Override public PsiReference getReference() {
- return this;
- }
-
- @Override public PsiElement getElement() {
- return this;
- }
-
- @Override public TextRange getRangeInElement() {
- return new TextRange(0, getTextLength());
- }
-
- @Nullable @Override public PsiClass resolve() {
- return NameUtils.resolveSmaliType(this, smaliName);
- }
-
- @NotNull @Override public String getCanonicalText() {
- return NameUtils.resolveSmaliToJavaType(this, smaliName);
- }
-
- @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
- throw new UnsupportedOperationException();
- }
-
- @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
- throw new UnsupportedOperationException();
- }
-
- @Override public boolean isReferenceTo(PsiElement element) {
- if (!(element instanceof PsiClassType)) {
- return false;
- }
- return element.getManager().areElementsEquivalent(element, resolve());
- }
-
- @NotNull @Override public Object[] getVariants() {
- throw new RuntimeException("Variants are not available for light references");
- }
-
- @Override public boolean isSoft() {
- return false;
- }
-
- @NotNull @Override public PsiAnnotation[] getAnnotations() {
- return new PsiAnnotation[0];
- }
-
- @NotNull @Override public PsiAnnotation[] getApplicableAnnotations() {
- return new PsiAnnotation[0];
- }
-
- @Nullable @Override public PsiAnnotation findAnnotation(@NotNull @NonNls String qualifiedName) {
- return null;
- }
-
- @NotNull @Override public PsiAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) {
- throw new UnsupportedOperationException();
- }
-
- // ***************************************************************************
- // Below are the PsiJavaCodeReferenceElement-specific methods
-
- @Override public void processVariants(@NotNull PsiScopeProcessor processor) {
- // TODO: maybe just do nothing?
- throw new UnsupportedOperationException();
- }
-
- @Nullable @Override public PsiElement getReferenceNameElement() {
- // TODO: implement if needed
- throw new UnsupportedOperationException();
- }
-
- @Nullable @Override public PsiReferenceParameterList getParameterList() {
- // TODO: (generics) implement this
- return null;
- }
-
- @NotNull @Override public PsiType[] getTypeParameters() {
- // TODO: (generics) implement this
- return new PsiType[0];
- }
-
- @Override public boolean isQualified() {
- // TODO: should this return false for classes in the top level package?
- return true;
- }
-
- @Override public String getQualifiedName() {
- return getCanonicalText();
- }
-
- @NotNull @Override public JavaResolveResult advancedResolve(boolean incompleteCode) {
- PsiClass element = resolve();
- if (element == null) {
- return JavaResolveResult.EMPTY;
- }
- return new CandidateInfo(element, PsiSubstitutor.EMPTY);
- }
-
- @NotNull @Override public JavaResolveResult[] multiResolve(boolean incompleteCode) {
- PsiClass element = resolve();
- if (element == null) {
- return JavaResolveResult.EMPTY_ARRAY;
- }
- return new CandidateInfo[] { new CandidateInfo(element, PsiSubstitutor.EMPTY) };
- }
-
- @Nullable @Override public PsiElement getQualifier() {
- // TODO: implement this if needed
- throw new UnsupportedOperationException();
- }
-
- @Nullable @Override public String getReferenceName() {
- return getName();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotation.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotation.java
deleted file mode 100644
index ac3dd81f..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotation.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.lang.ASTNode;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.PsiImplUtil;
-import com.intellij.psi.meta.PsiMetaData;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliElementTypes;
-import org.jf.smalidea.psi.stub.SmaliAnnotationStub;
-
-public class SmaliAnnotation extends SmaliStubBasedPsiElement implements PsiAnnotation {
- public SmaliAnnotation(@NotNull SmaliAnnotationStub stub) {
- super(stub, SmaliElementTypes.ANNOTATION);
- }
-
- public SmaliAnnotation(@NotNull ASTNode node) {
- super(node);
- }
-
- @NotNull @Override public SmaliAnnotationParameterList getParameterList() {
- SmaliAnnotationParameterList paramList = findChildByClass(SmaliAnnotationParameterList.class);
- // The structure of the parser should ensure the param list is always present, even if there are syntax errors
- assert paramList != null;
- return paramList;
- }
-
- @Nullable @Override public String getQualifiedName() {
- PsiJavaCodeReferenceElement nameElement = getNameReferenceElement();
- if (nameElement != null) {
- return nameElement.getQualifiedName();
- }
- return null;
- }
-
- @Nullable public String getSmaliName() {
- SmaliAnnotationStub stub = getStub();
- if (stub != null) {
- return stub.getAnnotationSmaliTypeName();
- }
-
- SmaliClassTypeElement classType = findChildByClass(SmaliClassTypeElement.class);
- if (classType == null) {
- return null;
- }
- return classType.getSmaliName();
- }
-
- @Nullable @Override public PsiJavaCodeReferenceElement getNameReferenceElement() {
- SmaliAnnotationStub stub = getStub();
- if (stub != null) {
- String smaliName = stub.getAnnotationSmaliTypeName();
- if (smaliName != null) {
- return new LightSmaliClassTypeElement(getManager(), smaliName);
- }
- }
- return findChildByClass(SmaliClassTypeElement.class);
- }
-
- @Nullable @Override public PsiAnnotationMemberValue findAttributeValue(@Nullable @NonNls String attributeName) {
- return PsiImplUtil.findAttributeValue(this, attributeName);
- }
-
- @Nullable @Override
- public PsiAnnotationMemberValue findDeclaredAttributeValue(@Nullable @NonNls String attributeName) {
- return PsiImplUtil.findDeclaredAttributeValue(this, attributeName);
- }
-
- @Override
- public T setDeclaredAttributeValue(
- @Nullable @NonNls String attributeName, @Nullable T value) {
- // TODO: implement this
- throw new UnsupportedOperationException();
- }
-
- @Nullable @Override public PsiAnnotationOwner getOwner() {
- return (PsiAnnotationOwner)getParentByStub();
- }
-
- @Nullable @Override public PsiMetaData getMetaData() {
- // I have no idea what this is
- return null;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotationElement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotationElement.java
deleted file mode 100644
index 10784f8f..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotationElement.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.lang.ASTNode;
-import com.intellij.psi.PsiAnnotationMemberValue;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiNameValuePair;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.SmaliTokens;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliAnnotationElement extends SmaliCompositeElement implements PsiNameValuePair {
- // TODO: consider making this a stub
-
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliAnnotationElement();
- }
- };
-
- public SmaliAnnotationElement() {
- super(SmaliElementTypes.ANNOTATION_ELEMENT);
- }
-
- @Override public String getName() {
- SmaliAnnotationElementName identifier = getNameIdentifier();
- if (identifier != null) {
- return identifier.getName();
- }
- return null;
- }
-
- @Nullable @Override public SmaliAnnotationElementName getNameIdentifier() {
- return findChildByClass(SmaliAnnotationElementName.class);
- }
-
- @Nullable @Override public PsiAnnotationMemberValue getValue() {
- ASTNode equalNode = findChildByType(SmaliTokens.EQUAL);
- if (equalNode == null) {
- return null;
- }
-
- PsiElement nextElement = equalNode.getPsi().getNextSibling();
- while (nextElement != null) {
- if (nextElement instanceof PsiAnnotationMemberValue) {
- return (PsiAnnotationMemberValue)nextElement;
- }
- nextElement = nextElement.getNextSibling();
- }
- return null;
- }
-
- @NotNull @Override public PsiAnnotationMemberValue setValue(@NotNull PsiAnnotationMemberValue newValue) {
- // TODO: implement this
- throw new UnsupportedOperationException();
- }
-
- @Nullable @Override public String getLiteralValue() {
- // Not applicable for smali
- return null;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotationElementName.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotationElementName.java
deleted file mode 100644
index 656b4eff..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotationElementName.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.*;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliAnnotationElementName extends SmaliCompositeElement implements PsiIdentifier, PsiReference {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliAnnotationElementName();
- }
- };
-
- public SmaliAnnotationElementName() {
- super(SmaliElementTypes.ANNOTATION_ELEMENT_NAME);
- }
-
- @Override public IElementType getTokenType() {
- return getElementType();
- }
-
- @Override public String getName() {
- return getText();
- }
-
- @Nullable
- public SmaliAnnotation getContainingAnnotation() {
- return findAncestorByClass(SmaliAnnotation.class);
- }
-
- @Override public PsiElement bindToElement(PsiElement element) throws IncorrectOperationException {
- //TODO: implement this if needed
- throw new IncorrectOperationException();
- }
-
- @Override public PsiElement getElement() {
- return this;
- }
-
- @Override public TextRange getRangeInElement() {
- return new TextRange(0, getTextLength());
- }
-
- @Nullable @Override public PsiElement resolve() {
- SmaliAnnotation smaliAnnotation = getContainingAnnotation();
- if (smaliAnnotation == null) {
- return null;
- }
-
- String annotationType = smaliAnnotation.getQualifiedName();
- if (annotationType == null) {
- return null;
- }
-
- JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject());
- PsiClass annotationClass = facade.findClass(annotationType, getResolveScope());
- if (annotationClass == null) {
- return null;
- }
-
- for (PsiMethod method : annotationClass.findMethodsByName(getName(), true)) {
- if (method.getParameterList().getParametersCount() == 0) {
- return method;
- }
- }
- return null;
- }
-
- @NotNull @Override public String getCanonicalText() {
- // TODO: return a full method reference here?
- String name = getName();
- if (name == null) {
- return "";
- }
- return name;
- }
-
- @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
- //TODO: implement this
- throw new IncorrectOperationException();
- }
-
- @Override public boolean isReferenceTo(PsiElement element) {
- return resolve() == element;
- }
-
- @NotNull @Override public Object[] getVariants() {
- return ArrayUtil.EMPTY_OBJECT_ARRAY;
- }
-
- @Override public boolean isSoft() {
- return false;
- }
-
- @Override public PsiReference getReference() {
- return this;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotationParameterList.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotationParameterList.java
deleted file mode 100644
index 7feaa9ee..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliAnnotationParameterList.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.psi.PsiAnnotationParameterList;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliAnnotationParameterList extends SmaliCompositeElement implements PsiAnnotationParameterList {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliAnnotationParameterList();
- }
- };
-
- public SmaliAnnotationParameterList() {
- super(SmaliElementTypes.ANNOTATION_PARAMETER_LIST);
- }
-
- @NotNull @Override public SmaliAnnotationElement[] getAttributes() {
- return findChildrenByClass(SmaliAnnotationElement.class);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliArrayDataElement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliArrayDataElement.java
deleted file mode 100644
index 85f62138..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliArrayDataElement.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliArrayDataElement extends SmaliCompositeElement {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliArrayDataElement();
- }
- };
-
- public SmaliArrayDataElement() {
- super(SmaliElementTypes.ARRAY_DATA_ELEMENT);
- }
-
- @Nullable
- public SmaliLiteral getValue() {
- return findChildByClass(SmaliLiteral.class);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliArrayTypeElement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliArrayTypeElement.java
deleted file mode 100644
index 1b54a9c0..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliArrayTypeElement.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.lang.ASTNode;
-import com.intellij.psi.PsiArrayType;
-import com.intellij.psi.PsiType;
-import com.intellij.psi.PsiTypeElement;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.SmaliTokens;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliArrayTypeElement extends SmaliTypeElement {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliArrayTypeElement();
- }
- };
-
- public SmaliArrayTypeElement() {
- super(SmaliElementTypes.ARRAY_TYPE);
- }
-
- @NotNull @Override public PsiType getType() {
- ASTNode token = findChildByType(SmaliTokens.ARRAY_TYPE_PREFIX);
- assert token != null;
- PsiTypeElement baseType = findChildByClass(PsiTypeElement.class);
- assert baseType != null;
-
- PsiArrayType arrayType = new PsiArrayType(baseType.getType());
- int dimensions = token.getTextLength() - 1;
- while (dimensions > 0) {
- arrayType = new PsiArrayType(arrayType);
- dimensions--;
- }
- return arrayType;
- }
-
- @Nullable @Override public SmaliClassTypeElement getInnermostComponentReferenceElement() {
- return findChildByClass(SmaliClassTypeElement.class);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliBaseReferenceList.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliBaseReferenceList.java
deleted file mode 100644
index b47d5126..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliBaseReferenceList.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.lang.ASTNode;
-import com.intellij.psi.PsiReferenceList;
-import com.intellij.psi.StubBasedPsiElement;
-import com.intellij.psi.stubs.IStubElementType;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.psi.stub.SmaliBaseReferenceListStub;
-import org.jf.smalidea.util.NameUtils;
-
-public abstract class SmaliBaseReferenceList
- extends SmaliStubBasedPsiElement implements StubBasedPsiElement, PsiReferenceList {
- protected SmaliBaseReferenceList(@NotNull StubT stub, @NotNull IStubElementType nodeType) {
- super(stub, nodeType);
- }
-
- protected SmaliBaseReferenceList(@NotNull ASTNode node) {
- super(node);
- }
-
- @NotNull @Override public SmaliClassType[] getReferencedTypes() {
- StubT stub = getStub();
- if (stub != null) {
- return stub.getReferencedTypes();
- }
-
- SmaliClassTypeElement[] references = getReferenceElements();
-
- SmaliClassType[] referenceTypes = new SmaliClassType[references.length];
-
- for (int i=0; i implements PsiClass, SmaliModifierListOwner {
- public SmaliClass(@NotNull SmaliClassStub stub) {
- super(stub, SmaliElementTypes.CLASS);
- }
-
- public SmaliClass(@NotNull ASTNode node) {
- super(node);
- }
-
- @Nonnull
- @Override
- public String getName() {
- String name = getQualifiedName();
- if (name == null) {
- return "";
- }
- int lastDot = name.lastIndexOf('.');
- if (lastDot < 0) {
- return name;
- }
- return name.substring(lastDot+1);
- }
-
- @Override public ItemPresentation getPresentation() {
- return ItemPresentationProviders.getItemPresentation(this);
- }
-
- @Nullable @Override public String getQualifiedName() {
- SmaliClassStatement classStatement = getStubOrPsiChild(SmaliElementTypes.CLASS_STATEMENT);
- if (classStatement == null) {
- return null;
- }
- return classStatement.getQualifiedName();
- }
-
- @NotNull public String getPackageName() {
- String name = getQualifiedName();
- if (name == null) {
- return "";
- }
- int lastDot = name.lastIndexOf('.');
- if (lastDot < 0) {
- return "";
- }
- return name.substring(0, lastDot);
- }
-
- @Override public boolean hasTypeParameters() {
- // TODO: implement generics
- return false;
- }
-
- @Override public boolean isInterface() {
- return hasModifierProperty("interface");
- }
-
- @Override public boolean isAnnotationType() {
- return hasModifierProperty("annotation");
- }
-
- @Override public boolean isEnum() {
- return hasModifierProperty("enum");
- }
-
- @Nullable public SmaliSuperStatement getSuperStatement() {
- return findChildByClass(SmaliSuperStatement.class);
- }
-
- @NotNull @Override public SmaliExtendsList getExtendsList() {
- return getRequiredStubOrPsiChild(SmaliElementTypes.EXTENDS_LIST);
- }
-
- @NotNull public SmaliImplementsStatement[] getImplementsStatements() {
- return findChildrenByClass(SmaliImplementsStatement.class);
- }
-
- @NotNull @Override public SmaliImplementsList getImplementsList() {
- return getRequiredStubOrPsiChild(SmaliElementTypes.IMPLEMENTS_LIST);
- }
-
- @NotNull @Override public SmaliClassType[] getExtendsListTypes() {
- return getExtendsList().getReferencedTypes();
- }
-
- @NotNull @Override public SmaliClassType[] getImplementsListTypes() {
- return getImplementsList().getReferencedTypes();
- }
-
- @Nullable @Override public PsiClass getSuperClass() {
- return PsiClassImplUtil.getSuperClass(this);
- }
-
- @Override public PsiClass[] getInterfaces() {
- return PsiClassImplUtil.getInterfaces(this);
- }
-
- @NotNull @Override public PsiClass[] getSupers() {
- return PsiClassImplUtil.getSupers(this);
- }
-
- @NotNull @Override public PsiClassType[] getSuperTypes() {
- return PsiClassImplUtil.getSuperTypes(this);
- }
-
- @NotNull @Override public SmaliField[] getFields() {
- SmaliField[] fields = getStubOrPsiChildren(SmaliElementTypes.FIELD, new SmaliField[0]);
- List filteredFields = null;
- for (int i=fields.length-1; i>=0; i--) {
- SmaliField field = fields[i];
- if (field.getName() == null) {
- if (filteredFields == null) {
- filteredFields = Lists.newArrayList(fields);
- }
- filteredFields.remove(i);
- }
- }
- if (filteredFields != null) {
- return filteredFields.toArray(new SmaliField[filteredFields.size()]);
- }
- return fields;
- }
-
- @NotNull @Override public SmaliMethod[] getMethods() {
- return getStubOrPsiChildren(SmaliElementTypes.METHOD, new SmaliMethod[0]);
- }
-
- @NotNull @Override public PsiMethod[] getConstructors() {
- return PsiImplUtil.getConstructors(this);
- }
-
- @NotNull @Override public PsiClass[] getInnerClasses() {
- return new PsiClass[0];
- }
-
- @NotNull @Override public PsiClassInitializer[] getInitializers() {
- // TODO: do we need to return the method here?
- return new PsiClassInitializer[0];
- }
-
- @NotNull @Override public PsiField[] getAllFields() {
- return PsiClassImplUtil.getAllFields(this);
- }
-
- @NotNull @Override public PsiMethod[] getAllMethods() {
- return PsiClassImplUtil.getAllMethods(this);
- }
-
- @NotNull @Override public PsiClass[] getAllInnerClasses() {
- return new PsiClass[0];
- }
-
- @Nullable @Override public PsiField findFieldByName(@NonNls String name, boolean checkBases) {
- return PsiClassImplUtil.findFieldByName(this, name, checkBases);
- }
-
- @Nullable @Override public PsiMethod findMethodBySignature(PsiMethod patternMethod, boolean checkBases) {
- return PsiClassImplUtil.findMethodBySignature(this, patternMethod, checkBases);
- }
-
- @NotNull @Override public PsiMethod[] findMethodsBySignature(PsiMethod patternMethod, boolean checkBases) {
- return PsiClassImplUtil.findMethodsBySignature(this, patternMethod, checkBases);
- }
-
- @NotNull @Override public PsiMethod[] findMethodsByName(@NonNls String name, boolean checkBases) {
- return PsiClassImplUtil.findMethodsByName(this, name, checkBases);
- }
-
- @NotNull @Override
- public List> findMethodsAndTheirSubstitutorsByName(@NonNls String name, boolean checkBases) {
- return PsiClassImplUtil.findMethodsAndTheirSubstitutorsByName(this, name, checkBases);
- }
-
- @NotNull @Override public List> getAllMethodsAndTheirSubstitutors() {
- return PsiClassImplUtil.getAllWithSubstitutorsByMap(this, PsiClassImplUtil.MemberType.METHOD);
- }
-
- @Nullable @Override public PsiClass findInnerClassByName(@NonNls String name, boolean checkBases) {
- return null;
- }
-
- @Nullable @Override public PsiElement getLBrace() {
- return null;
- }
-
- @Nullable @Override public PsiElement getRBrace() {
- return null;
- }
-
- @Nullable public SmaliClassStatement getClassStatement() {
- return getStubOrPsiChild(SmaliElementTypes.CLASS_STATEMENT);
- }
-
- @Nullable @Override public SmaliClassDescriptor getNameIdentifier() {
- SmaliClassStatement classStatement = getClassStatement();
- if (classStatement == null) {
- return null;
- }
- return classStatement.getNameIdentifier();
- }
-
- @Override public PsiElement getScope() {
- return null;
- }
-
- @Override public boolean isInheritor(@NotNull PsiClass baseClass, boolean checkDeep) {
- return InheritanceImplUtil.isInheritor(this, baseClass, checkDeep);
- }
-
- @Override public boolean isInheritorDeep(PsiClass baseClass, @Nullable PsiClass classToByPass) {
- return InheritanceImplUtil.isInheritorDeep(this, baseClass, classToByPass);
- }
-
- @Nullable @Override public PsiClass getContainingClass() {
- return null;
- }
-
- @NotNull @Override public Collection getVisibleSignatures() {
- return ImmutableList.of();
- }
-
- @Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
- SmaliClassStatement classStatement = getClassStatement();
- if (classStatement == null) {
- throw new IncorrectOperationException();
- }
-
- SmaliClassTypeElement classTypeElement = classStatement.getNameElement();
- if (classTypeElement == null) {
- throw new IncorrectOperationException();
- }
-
- String expectedPath = "/" + getName() + ".smali";
-
- VirtualFile virtualFile = this.getContainingFile().getVirtualFile();
- if (virtualFile != null) {
- String actualPath = virtualFile.getPath();
- if (actualPath.endsWith(expectedPath)) {
- getContainingFile().setName(name + ".smali");
- }
- }
-
- String packageName = this.getPackageName();
- String newName;
- if (packageName.length() > 0) {
- newName = packageName + "." + name;
- } else {
- newName = name;
- }
- classTypeElement.handleElementRename(newName);
- return this;
- }
-
- public void setPackageName(@NonNls @NotNull String packageName) {
- SmaliClassStatement classStatement = getClassStatement();
- if (classStatement == null) {
- throw new IncorrectOperationException();
- }
-
- SmaliClassTypeElement classTypeElement = classStatement.getNameElement();
- if (classTypeElement == null) {
- throw new IncorrectOperationException();
- }
-
- String newName;
- if (packageName.length() > 0) {
- newName = packageName + "." + getName();
- } else {
- newName = getName();
- }
-
- classTypeElement.handleElementRename(newName);
- }
-
- @Nullable @Override public PsiDocComment getDocComment() {
- return null;
- }
-
- @Override public boolean isDeprecated() {
- return false;
- }
-
- @Nullable @Override public PsiTypeParameterList getTypeParameterList() {
- return null;
- }
-
- @NotNull @Override public PsiTypeParameter[] getTypeParameters() {
- return new PsiTypeParameter[0];
- }
-
- @Nullable @Override public SmaliModifierList getModifierList() {
- SmaliClassStatement classStatement = getStubOrPsiChild(SmaliElementTypes.CLASS_STATEMENT);
- if (classStatement == null) {
- return null;
- }
- return classStatement.getModifierList();
- }
-
- @Override public boolean hasModifierProperty(@ModifierConstant @NonNls @NotNull String name) {
- SmaliModifierList smaliModifierList = getModifierList();
- return smaliModifierList != null && smaliModifierList.hasModifierProperty(name);
- }
-
- @NotNull @Override public SmaliAnnotation[] getAnnotations() {
- return getStubOrPsiChildren(SmaliElementTypes.ANNOTATION, new SmaliAnnotation[0]);
- }
-
- @NotNull @Override public SmaliAnnotation[] getApplicableAnnotations() {
- return getAnnotations();
- }
-
- @Nullable @Override public SmaliAnnotation findAnnotation(@NotNull @NonNls String qualifiedName) {
- for (SmaliAnnotation annotation: getAnnotations()) {
- if (qualifiedName.equals(annotation.getQualifiedName())) {
- return annotation;
- }
- }
- return null;
- }
-
- @NotNull @Override public SmaliAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) {
- // TODO: implement this
- return null;
- }
-
- @Nullable public Location getLocationForSourcePosition(@Nonnull ReferenceType type,
- @Nonnull SourcePosition position) {
-
- SmaliMethod[] smaliMethods = findChildrenByType(SmaliElementTypes.METHOD, SmaliMethod.class);
-
- for (SmaliMethod smaliMethod: smaliMethods) {
- //TODO: check the start line+end line of the method
- int offset = smaliMethod.getOffsetForLine(position.getLine());
- if (offset != -1) {
- List methods = type.methodsByName(smaliMethod.getName(),
- smaliMethod.getMethodPrototype().getText());
- if (methods.size() > 0) {
- return methods.get(0).locationOfCodeIndex(offset/2);
- }
- }
- }
- return null;
- }
-
- @Override
- public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state,
- PsiElement lastParent, @NotNull PsiElement place) {
- return PsiClassImplUtil.processDeclarationsInClass(this, processor, state, null, lastParent, place,
- PsiUtil.getLanguageLevel(place), false);
- }
-
- @Nullable @Override protected Icon getElementIcon(@IconFlags int flags) {
- return SmaliIcons.SmaliIcon;
- }
-}
\ No newline at end of file
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliClassStatement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliClassStatement.java
deleted file mode 100644
index add3c1b2..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliClassStatement.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.lang.ASTNode;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliElementTypes;
-import org.jf.smalidea.psi.iface.SmaliModifierListOwner;
-import org.jf.smalidea.psi.leaf.SmaliClassDescriptor;
-import org.jf.smalidea.psi.stub.SmaliClassStatementStub;
-import org.jf.smalidea.util.NameUtils;
-
-public class SmaliClassStatement extends SmaliStubBasedPsiElement
- implements SmaliModifierListOwner {
- public SmaliClassStatement(@NotNull SmaliClassStatementStub stub) {
- super(stub, SmaliElementTypes.CLASS_STATEMENT);
- }
-
- public SmaliClassStatement(@NotNull ASTNode node) {
- super(node);
- }
-
- @Nullable
- public SmaliClassTypeElement getNameElement() {
- return findChildByClass(SmaliClassTypeElement.class);
- }
-
- @Nullable
- public SmaliClass getContainingClass() {
- return getStubOrPsiParentOfType(SmaliClass.class);
- }
-
- @Nullable
- public SmaliClassDescriptor getNameIdentifier() {
- SmaliClassTypeElement classTypeElement = getNameElement();
- if (classTypeElement == null) {
- return null;
- }
- return classTypeElement.getReferenceNameElement();
- }
-
- /**
- * @return the fully qualified java-style name of the class in this .class statement
- */
- @Nullable
- public String getQualifiedName() {
- SmaliClassStatementStub stub = getStub();
- if (stub != null) {
- return stub.getQualifiedName();
- }
-
- SmaliClassTypeElement classType = findChildByClass(SmaliClassTypeElement.class);
- if (classType == null) {
- return null;
- }
- // Since this is a class declared in smali, we don't have to worry about handling inner classes,
- // so we can do a pure textual translation of the class name
- return NameUtils.smaliToJavaType(classType.getSmaliName());
- }
-
- @Nullable
- public SmaliModifierList getModifierList() {
- return getStubOrPsiChild(SmaliElementTypes.MODIFIER_LIST);
- }
-
- @NotNull
- @Override
- public SmaliAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) {
- SmaliClass containingClass = getContainingClass();
- if (containingClass == null) {
- // TODO: what should we do here?
- return null;
- }
- return containingClass.addAnnotation(qualifiedName);
- }
-
- @NotNull
- @Override
- public SmaliAnnotation[] getAnnotations() {
- SmaliClass containingClass = getContainingClass();
- if (containingClass == null) {
- return new SmaliAnnotation[0];
- }
- return containingClass.getAnnotations();
- }
-
- @NotNull
- @Override
- public SmaliAnnotation[] getApplicableAnnotations() {
- SmaliClass containingClass = getContainingClass();
- if (containingClass == null) {
- return new SmaliAnnotation[0];
- }
- return containingClass.getApplicableAnnotations();
- }
-
- @Nullable
- @Override
- public SmaliAnnotation findAnnotation(@NotNull @NonNls String qualifiedName) {
- SmaliClass containingClass = getContainingClass();
- if (containingClass == null) {
- return null;
- }
- return containingClass.findAnnotation(qualifiedName);
- }
-
- @Override
- public boolean hasModifierProperty(@NonNls @NotNull String name) {
- SmaliClass containingClass = getContainingClass();
- if (containingClass == null) {
- return false;
- }
- return containingClass.hasModifierProperty(name);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliClassType.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliClassType.java
deleted file mode 100644
index 6d5bbaba..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliClassType.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.util.NameUtils;
-
-public class SmaliClassType extends PsiClassType {
- private final PsiTypeElement element;
-
- public SmaliClassType(PsiTypeElement element) {
- this(element, LanguageLevel.JDK_1_5);
- }
-
- public SmaliClassType(PsiTypeElement element, LanguageLevel languageLevel) {
- super(languageLevel);
- this.element = element;
- }
-
- @Nullable
- @Override
- public PsiClass resolve() {
- PsiReference reference = element.getReference();
- if (reference == null) {
- return null;
- }
- PsiElement resolved = reference.resolve();
- if (resolved instanceof PsiClass) {
- return (PsiClass)resolved;
- }
- return null;
- }
-
- @Override
- public String getClassName() {
- PsiClass resolved = resolve();
- if (resolved != null) {
- return NameUtils.shortNameFromQualifiedName(resolved.getQualifiedName());
- }
- return NameUtils.shortNameFromQualifiedName(element.getText());
- }
-
- @NotNull
- @Override
- public PsiType[] getParameters() {
- // TODO: (generics) implement this
- return PsiType.EMPTY_ARRAY;
- }
-
- @NotNull
- @Override
- public ClassResolveResult resolveGenerics() {
- // TODO: (generics) implement this
- return new ClassResolveResult() {
- @Override
- public PsiClass getElement() {
- return resolve();
- }
-
- @Override
- public PsiSubstitutor getSubstitutor() {
- return PsiSubstitutor.EMPTY;
- }
-
- @Override
- public boolean isPackagePrefixPackageReference() {
- return false;
- }
-
- @Override
- public boolean isAccessible() {
- return true;
- }
-
- @Override
- public boolean isStaticsScopeCorrect() {
- return true;
- }
-
- @Override
- public PsiElement getCurrentFileResolveScope() {
- return null;
- }
-
- @Override
- public boolean isValidResult() {
- return true;
- }
- };
- }
-
- @NotNull
- @Override
- public SmaliClassType rawType() {
- // TODO: (generics) implement this
- return this;
- }
-
- @Override
- @NotNull
- public String getPresentableText() {
- return getCanonicalText();
- }
-
- @Override
- @NotNull
- public String getCanonicalText() {
- PsiClass psiClass = resolve();
- if (psiClass != null) {
- String qualifiedName = psiClass.getQualifiedName();
- if (qualifiedName != null) {
- return qualifiedName;
- }
- }
- return NameUtils.smaliToJavaType(element.getText());
- }
-
- @Override
- @NotNull
- public String getInternalCanonicalText() {
- return getCanonicalText();
- }
-
- @Override
- public boolean isValid() {
- return element.isValid();
- }
-
- @Override
- public boolean equalsToText(@NonNls String text) {
- return text.equals(getCanonicalText());
- }
-
- @NotNull
- @Override
- public GlobalSearchScope getResolveScope() {
- return element.getResolveScope();
- }
-
- @NotNull
- @Override
- public LanguageLevel getLanguageLevel() {
- return myLanguageLevel;
- }
-
- @NotNull
- @Override
- public PsiClassType setLanguageLevel(@NotNull LanguageLevel languageLevel) {
- return new SmaliClassType(element, languageLevel);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliClassTypeElement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliClassTypeElement.java
deleted file mode 100644
index b491f6df..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliClassTypeElement.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
-import com.intellij.psi.infos.CandidateInfo;
-import com.intellij.psi.scope.PsiScopeProcessor;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-import org.jf.smalidea.psi.leaf.SmaliClassDescriptor;
-import org.jf.smalidea.util.NameUtils;
-
-public class SmaliClassTypeElement extends SmaliTypeElement implements PsiJavaCodeReferenceElement {
- public static final SmaliClassTypeElement[] EMPTY_ARRAY = new SmaliClassTypeElement[0];
-
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliClassTypeElement();
- }
- };
-
- @Nullable private SmaliClassType classType = null;
-
- public SmaliClassTypeElement() {
- super(SmaliElementTypes.CLASS_TYPE);
- }
-
- @NotNull @Override public SmaliClassType getType() {
- if (classType == null) {
- classType = new SmaliClassType(this);
- }
- return classType;
- }
-
- @Override public String getName() {
- return NameUtils.shortNameFromQualifiedName(getCanonicalText());
- }
-
- @Nullable @Override public SmaliClassTypeElement getInnermostComponentReferenceElement() {
- return this;
- }
-
- @Override public PsiElement getElement() {
- return this;
- }
-
- @Override public PsiReference getReference() {
- return this;
- }
-
- @Override public TextRange getRangeInElement() {
- return new TextRange(0, getTextLength());
- }
-
- @Nullable @Override public PsiClass resolve() {
- return NameUtils.resolveSmaliType(this, getText());
- }
-
- @NotNull @Override public String getCanonicalText() {
- return getQualifiedName();
- }
-
- @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
- SmaliClassDescriptor descriptor = getReferenceNameElement();
- if (descriptor == null) {
- throw new IncorrectOperationException();
- }
-
- SmaliClassDescriptor newDescriptor = new SmaliClassDescriptor(NameUtils.javaToSmaliType(newElementName));
- CodeEditUtil.setNodeGenerated(newDescriptor, true);
-
- this.replaceChild(descriptor, newDescriptor);
- return this;
- }
-
- @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
- if (element instanceof PsiClass) {
- handleElementRename(((PsiClass) element).getQualifiedName());
- return this;
- }
- throw new IncorrectOperationException();
- }
-
- @Override public boolean isReferenceTo(PsiElement element) {
- if (!(element instanceof PsiClass)) {
- return false;
- }
- return element.getManager().areElementsEquivalent(element, resolve());
- }
-
- @NotNull @Override public Object[] getVariants() {
- // TODO: implement this?
- return new Object[0];
- }
-
- @Override public boolean isSoft() {
- return false;
- }
-
- // ***************************************************************************
- // Below are the PsiJavaCodeReferenceElement-specific methods
-
- @Override public void processVariants(@NotNull PsiScopeProcessor processor) {
- // TODO: maybe just do nothing?
- throw new UnsupportedOperationException();
- }
-
- @Nullable @Override public SmaliClassDescriptor getReferenceNameElement() {
- return findChildByClass(SmaliClassDescriptor.class);
- }
-
- @Nullable @Override public PsiReferenceParameterList getParameterList() {
- // TODO: (generics) implement this
- return null;
- }
-
- @NotNull @Override public PsiType[] getTypeParameters() {
- // TODO: (generics) implement this
- return new PsiType[0];
- }
-
- @Override public boolean isQualified() {
- // TODO: should this return false for classes in the top level package?
- return true;
- }
-
- @Override public String getQualifiedName() {
- PsiClass psiClass = resolve();
- if (psiClass != null) {
- return psiClass.getQualifiedName();
- }
- return NameUtils.smaliToJavaType(getText());
- }
-
- @NotNull @Override public JavaResolveResult advancedResolve(boolean incompleteCode) {
- PsiClass element = resolve();
- if (element == null) {
- return JavaResolveResult.EMPTY;
- }
- return new CandidateInfo(element, PsiSubstitutor.EMPTY);
- }
-
- @NotNull @Override public JavaResolveResult[] multiResolve(boolean incompleteCode) {
- PsiClass element = resolve();
- if (element == null) {
- return JavaResolveResult.EMPTY_ARRAY;
- }
- return new CandidateInfo[] { new CandidateInfo(element, PsiSubstitutor.EMPTY) };
- }
-
- @Nullable @Override public PsiElement getQualifier() {
- return null;
- }
-
- @Nullable @Override public String getReferenceName() {
- return getName();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliCompositeElement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliCompositeElement.java
deleted file mode 100644
index d9c38c4e..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliCompositeElement.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.google.common.collect.ImmutableList;
-import com.intellij.lang.ASTNode;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.impl.source.tree.CompositePsiElement;
-import com.intellij.psi.tree.IElementType;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class SmaliCompositeElement extends CompositePsiElement {
- public SmaliCompositeElement(IElementType type) {
- super(type);
- }
-
- @NotNull
- @SuppressWarnings("unchecked")
- protected List findChildrenByType(IElementType elementType) {
- List result = ImmutableList.of();
- ASTNode child = getNode().getFirstChildNode();
- while (child != null) {
- if (elementType == child.getElementType()) {
- if (result.size() == 0) {
- result = new ArrayList();
- }
- result.add((ASTNode)child.getPsi());
- }
- child = child.getTreeNext();
- }
- return result;
- }
-
- @NotNull
- @SuppressWarnings("unchecked")
- protected T[] findChildrenByClass(Class aClass) {
- List result = new ArrayList();
- for (PsiElement cur = getFirstChild(); cur != null; cur = cur.getNextSibling()) {
- if (aClass.isInstance(cur)) result.add((T)cur);
- }
- return result.toArray((T[]) Array.newInstance(aClass, result.size()));
- }
-
- @Nullable
- @SuppressWarnings("unchecked")
- protected T findChildByClass(Class aClass) {
- for (PsiElement cur = getFirstChild(); cur != null; cur = cur.getNextSibling()) {
- if (aClass.isInstance(cur)) return (T)cur;
- }
- return null;
- }
-
- @Nullable
- @SuppressWarnings("unchecked")
- protected T findAncestorByClass(Class aClass) {
- PsiElement parent = getParent();
- while (parent != null) {
- if (aClass.isInstance(parent)) {
- return (T)parent;
- }
- parent = parent.getParent();
- }
- return null;
- }
-
- @Nullable
- @SuppressWarnings("unchecked")
- public T findNextSiblingByClass(@NotNull Class cls) {
- PsiElement prev = getNextSibling();
- while (true) {
- if (prev == null) {
- return null;
- } else if (cls.isInstance(prev)) {
- return (T)prev;
- }
- prev = prev.getNextSibling();
- }
- }
-
- @Nullable
- @SuppressWarnings("unchecked")
- public T findPrevSiblingByClass(@NotNull Class cls) {
- PsiElement prev = getPrevSibling();
- while (true) {
- if (prev == null) {
- return null;
- } else if (cls.isInstance(prev)) {
- return (T)prev;
- }
- prev = prev.getPrevSibling();
- }
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliEndLocalDebugStatement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliEndLocalDebugStatement.java
deleted file mode 100644
index 042596cf..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliEndLocalDebugStatement.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliEndLocalDebugStatement extends SmaliCompositeElement {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliEndLocalDebugStatement();
- }
- };
-
- public SmaliEndLocalDebugStatement() {
- super(SmaliElementTypes.END_LOCAL_DEBUG_STATEMENT);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliEpilogueDebugStatement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliEpilogueDebugStatement.java
deleted file mode 100644
index faaef090..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliEpilogueDebugStatement.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliEpilogueDebugStatement extends SmaliCompositeElement {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliEpilogueDebugStatement();
- }
- };
-
- public SmaliEpilogueDebugStatement() {
- super(SmaliElementTypes.EPILOGUE_DEBUG_STATEMENT);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliExtendsList.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliExtendsList.java
deleted file mode 100644
index ace9a976..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliExtendsList.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.google.common.collect.Lists;
-import com.intellij.lang.ASTNode;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.psi.SmaliElementTypes;
-import org.jf.smalidea.psi.stub.SmaliExtendsListStub;
-
-import java.util.List;
-
-public class SmaliExtendsList extends SmaliBaseReferenceList {
- public SmaliExtendsList(@NotNull SmaliExtendsListStub stub) {
- super(stub, SmaliElementTypes.EXTENDS_LIST);
- }
-
- public SmaliExtendsList(@NotNull ASTNode node) {
- super(node);
- }
-
- @NotNull @Override public SmaliClassTypeElement[] getReferenceElements() {
- if (((SmaliClass)getParent()).isInterface()) {
- return getImplementsElements();
- } else {
- return getExtendsElement();
- }
- }
-
- @NotNull private SmaliClassTypeElement[] getImplementsElements() {
- SmaliClass smaliClass = getStubOrPsiParentOfType(SmaliClass.class);
- assert smaliClass != null;
-
- SmaliImplementsStatement[] implementsStatements = smaliClass.getImplementsStatements();
- if (implementsStatements.length > 0) {
- // all implemented interfaces go in the extends list for an interface
- List types = Lists.newArrayList();
-
- for (SmaliImplementsStatement implementsStatement: implementsStatements) {
- SmaliClassTypeElement classReference = implementsStatement.getClassReference();
- if (classReference != null) {
- types.add(classReference);
- }
- }
- return types.toArray(new SmaliClassTypeElement[types.size()]);
- }
- return new SmaliClassTypeElement[0];
- }
-
- @NotNull private SmaliClassTypeElement[] getExtendsElement() {
- SmaliClass smaliClass = getStubOrPsiParentOfType(SmaliClass.class);
- assert smaliClass != null;
-
- SmaliSuperStatement superStatement = smaliClass.getSuperStatement();
- if (superStatement != null) {
- SmaliClassTypeElement classReference = superStatement.getClassReference();
- if (classReference != null) {
- return new SmaliClassTypeElement[] { classReference };
- }
- }
- return new SmaliClassTypeElement[0];
- }
-
- @Override public Role getRole() {
- return Role.EXTENDS_LIST;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliField.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliField.java
deleted file mode 100644
index 579401cf..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliField.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.lang.ASTNode;
-import com.intellij.psi.*;
-import com.intellij.psi.PsiModifier.ModifierConstant;
-import com.intellij.psi.impl.PsiImplUtil;
-import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliElementTypes;
-import org.jf.smalidea.psi.iface.SmaliModifierListOwner;
-import org.jf.smalidea.psi.stub.SmaliFieldStub;
-import org.jf.smalidea.util.NameUtils;
-
-public class SmaliField extends SmaliStubBasedPsiElement implements PsiField, SmaliModifierListOwner {
- public SmaliField(@NotNull SmaliFieldStub stub) {
- super(stub, SmaliElementTypes.FIELD);
- }
-
- public SmaliField(@NotNull ASTNode node) {
- super(node);
- }
-
- @Nullable @Override public String getName() {
- SmaliFieldStub stub = getStub();
- if (stub != null) {
- return stub.getName();
- }
-
- SmaliMemberName smaliMemberName = findChildByClass(SmaliMemberName.class);
- if (smaliMemberName == null || smaliMemberName.getText().isEmpty()) {
- return null;
- }
- return smaliMemberName.getText();
- }
-
- @NotNull @Override public SmaliModifierList getModifierList() {
- SmaliModifierList modifierList = getStubOrPsiChild(SmaliElementTypes.MODIFIER_LIST);
- assert modifierList != null;
- return modifierList;
- }
-
- @NotNull @Override public SmaliMemberName getNameIdentifier() {
- SmaliMemberName memberName = findChildByClass(SmaliMemberName.class);
- assert memberName != null;
- return memberName;
- }
-
- @Nullable @Override public PsiDocComment getDocComment() {
- return null;
- }
-
- @Override public boolean isDeprecated() {
- return PsiImplUtil.isDeprecatedByAnnotation(this);
- }
-
- @Nullable @Override public PsiClass getContainingClass() {
- return (PsiClass)getParentByStub();
- }
-
- @NotNull @Override public PsiType getType() {
- SmaliFieldStub stub = getStub();
- if (stub != null) {
- return NameUtils.resolveSmaliToPsiType(this, stub.getSmaliTypeName());
- }
- PsiTypeElement typeElement = getTypeElement();
- if (typeElement == null) {
- // If we don't have a type (i.e. syntax error), use Object as a safe-ish fallback
- PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
- return factory.createTypeFromText("java.lang.Object", this);
- }
- return getTypeElement().getType();
- }
-
- @Nullable @Override public SmaliTypeElement getTypeElement() {
- return findChildByClass(SmaliTypeElement.class);
- }
-
- @Nullable @Override public PsiExpression getInitializer() {
- // TODO: implement this
- return null;
- }
-
- @Override public boolean hasInitializer() {
- // TODO: implement this
- return false;
- }
-
- @Override public void normalizeDeclaration() throws IncorrectOperationException {
- // not applicable
- }
-
- @Nullable @Override public Object computeConstantValue() {
- // TODO: implement this
- return null;
- }
-
- @Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
- SmaliMemberName smaliMemberName = getNameIdentifier();
- smaliMemberName.setName(name);
- return this;
- }
-
- @Override public boolean hasModifierProperty(@ModifierConstant @NonNls @NotNull String name) {
- return getModifierList().hasModifierProperty(name);
- }
-
- @NotNull @Override public SmaliAnnotation[] getAnnotations() {
- return getStubOrPsiChildren(SmaliElementTypes.ANNOTATION, new SmaliAnnotation[0]);
- }
-
- @NotNull @Override public SmaliAnnotation[] getApplicableAnnotations() {
- return getAnnotations();
- }
-
- @Nullable @Override public SmaliAnnotation findAnnotation(@NotNull @NonNls String qualifiedName) {
- for (SmaliAnnotation annotation: getAnnotations()) {
- if (qualifiedName.equals(annotation.getQualifiedName())) {
- return annotation;
- }
- }
- return null;
- }
-
- @NotNull @Override public SmaliAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) {
- // TODO: implement this
- return null;
- }
-
- @Override public void setInitializer(@Nullable PsiExpression initializer) throws IncorrectOperationException {
- // TODO: implement this
- }
-
- @Override public int getTextOffset() {
- SmaliMemberName smaliMemberName = getNameIdentifier();
- if (smaliMemberName != null) {
- return smaliMemberName.getTextOffset();
- }
- return super.getTextOffset();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliFieldInitializer.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliFieldInitializer.java
deleted file mode 100644
index dcf0e858..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliFieldInitializer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliFieldInitializer extends SmaliCompositeElement {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliFieldInitializer();
- }
- };
-
- public SmaliFieldInitializer() {
- super(SmaliElementTypes.FIELD_INITIALIZER);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliFieldReference.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliFieldReference.java
deleted file mode 100644
index 0626c3a2..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliFieldReference.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiField;
-import com.intellij.psi.PsiReference;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliFieldReference extends SmaliCompositeElement implements PsiReference {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliFieldReference();
- }
- };
-
- public SmaliFieldReference() {
- super(SmaliElementTypes.FIELD_REFERENCE);
- }
-
- @Nullable
- public PsiClass getContainingClass() {
- SmaliClassTypeElement containingClassReference = getContainingType();
- if (containingClassReference == null) {
- return null;
- }
- PsiClass containingClass = containingClassReference.resolve();
- if (containingClass == null) {
- return null;
- }
-
- return containingClass;
- }
-
- @Nullable
- public SmaliClassTypeElement getContainingType() {
- return findChildByClass(SmaliClassTypeElement.class);
- }
-
- @Nullable
- public SmaliMemberName getMemberName() {
- return findChildByClass(SmaliMemberName.class);
- }
-
- @Nullable
- public SmaliTypeElement getFieldType() {
- SmaliTypeElement[] types = findChildrenByClass(SmaliTypeElement.class);
- assert types.length == 2;
- return types[1];
- }
-
- @Override public PsiReference getReference() {
- return this;
- }
-
- @Override public String getName() {
- SmaliMemberName memberName = getMemberName();
- if (memberName == null) {
- return null;
- }
- return memberName.getText();
- }
-
- @Override public PsiElement getElement() {
- return this;
- }
-
- @Override public TextRange getRangeInElement() {
- return new TextRange(0, getTextLength());
- }
-
- @NotNull @Override public String getCanonicalText() {
- return getText();
- }
-
- @Nullable @Override public PsiField resolve() {
- PsiClass containingClass = getContainingClass();
- if (containingClass == null) {
- return null;
- }
-
- SmaliMemberName memberName = getMemberName();
- if (memberName == null) {
- return null;
- }
-
- return containingClass.findFieldByName(memberName.getText(), true);
- }
-
- @Override public boolean isReferenceTo(PsiElement element) {
- return resolve() == element;
- }
-
- @NotNull @Override public Object[] getVariants() {
- return ArrayUtil.EMPTY_OBJECT_ARRAY;
- }
-
- @Override public boolean isSoft() {
- return false;
- }
-
- @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
- //TODO: implement this
- throw new IncorrectOperationException();
- }
-
- @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
- SmaliMemberName memberName = getMemberName();
- if (memberName == null) {
- throw new IncorrectOperationException();
- }
- memberName.setName(newElementName);
- return this;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliFile.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliFile.java
deleted file mode 100644
index 6ec3bd5f..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliFile.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.extapi.psi.PsiFileBase;
-import com.intellij.psi.FileViewProvider;
-import com.intellij.psi.PsiClassOwner;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.stubs.StubElement;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.SmaliFileType;
-import org.jf.smalidea.SmaliLanguage;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliFile extends PsiFileBase implements PsiClassOwner {
- public SmaliFile(FileViewProvider viewProvider) {
- super(viewProvider, SmaliLanguage.INSTANCE);
- }
-
- @NotNull @Override public SmaliFileType getFileType() {
- return SmaliFileType.INSTANCE;
- }
-
- @Nullable
- public SmaliClass getPsiClass() {
- StubElement extends PsiElement> stub = (StubElement extends PsiElement>)getStub();
- if (stub != null) {
- StubElement classElement = stub.findChildStubByType(SmaliElementTypes.CLASS);
- if (classElement != null) {
- return classElement.getPsi();
- } else {
- return null;
- }
- } else {
- return findChildByClass(SmaliClass.class);
- }
- }
-
- @NotNull @Override public SmaliClass[] getClasses() {
- SmaliClass smaliClass = getPsiClass();
- if (smaliClass == null) {
- return new SmaliClass[] {};
- } else {
- return new SmaliClass[] { smaliClass };
- }
- }
-
- @NotNull @Override public String getPackageName() {
- SmaliClass smaliClass = getPsiClass();
- if (smaliClass == null) {
- return "";
- }
- return smaliClass.getPackageName();
- }
-
- @Override public void setPackageName(String packageName) throws IncorrectOperationException {
- SmaliClass smaliClass = getPsiClass();
- if (smaliClass == null) {
- return;
- }
- smaliClass.setPackageName(packageName);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliImplementsList.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliImplementsList.java
deleted file mode 100644
index fb4a788f..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliImplementsList.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.google.common.collect.Lists;
-import com.intellij.lang.ASTNode;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.psi.SmaliElementTypes;
-import org.jf.smalidea.psi.stub.SmaliImplementsListStub;
-
-import java.util.List;
-
-public class SmaliImplementsList extends SmaliBaseReferenceList {
- public SmaliImplementsList(@NotNull SmaliImplementsListStub stub) {
- super(stub, SmaliElementTypes.IMPLEMENTS_LIST);
- }
-
- public SmaliImplementsList(@NotNull ASTNode node) {
- super(node);
- }
-
- @NotNull @Override public SmaliClassTypeElement[] getReferenceElements() {
- if (!((SmaliClass)getParent()).isInterface()) {
- return getImplementsElements();
- }
- return new SmaliClassTypeElement[0];
- }
-
- @NotNull private SmaliClassTypeElement[] getImplementsElements() {
- SmaliClass smaliClass = (SmaliClass)getParentByStub();
- assert smaliClass != null;
-
- SmaliImplementsStatement[] implementsStatements = smaliClass.getImplementsStatements();
- if (implementsStatements.length > 0) {
- // all implemented interfaces go in the extends list for an interface
- List types = Lists.newArrayList();
-
- for (SmaliImplementsStatement implementsStatement: implementsStatements) {
- SmaliClassTypeElement classReference = implementsStatement.getClassReference();
- if (classReference != null) {
- types.add(classReference);
- }
- }
- return types.toArray(new SmaliClassTypeElement[types.size()]);
- }
- return new SmaliClassTypeElement[0];
- }
-
- @Override public Role getRole() {
- return Role.IMPLEMENTS_LIST;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliImplementsStatement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliImplementsStatement.java
deleted file mode 100644
index e50d8c6b..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliImplementsStatement.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliImplementsStatement extends SmaliCompositeElement {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliImplementsStatement();
- }
- };
-
- public SmaliImplementsStatement() {
- super(SmaliElementTypes.IMPLEMENTS_STATEMENT);
- }
-
- @Nullable
- public SmaliClassTypeElement getClassReference() {
- return findChildByClass(SmaliClassTypeElement.class);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliInstruction.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliInstruction.java
deleted file mode 100644
index ecbdbb33..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliInstruction.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.google.common.base.Preconditions;
-import com.intellij.lang.ASTNode;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.dexlib2.Format;
-import org.jf.dexlib2.Opcode;
-import org.jf.dexlib2.Opcodes;
-import org.jf.dexlib2.analysis.AnalyzedInstruction;
-import org.jf.dexlib2.analysis.MethodAnalyzer;
-import org.jf.smalidea.SmaliTokens;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class SmaliInstruction extends SmaliCompositeElement {
- private static final int NO_OFFSET = -1;
-
- @Nullable private Opcode opcode;
- private int offset = NO_OFFSET;
-
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliInstruction();
- }
- };
-
- public SmaliInstruction() {
- super(SmaliElementTypes.INSTRUCTION);
- }
-
- @NotNull public SmaliMethod getParentMethod() {
- SmaliMethod smaliMethod = findAncestorByClass(SmaliMethod.class);
- assert smaliMethod != null;
- return smaliMethod;
- }
-
- @NotNull public Opcode getOpcode() {
- if (opcode == null) {
- ASTNode instructionNode = findChildByType(SmaliTokens.INSTRUCTION_TOKENS);
- // this should be impossible, based on the parser definition
- assert instructionNode != null;
-
- // TODO: put a project level Opcodes instance with the appropriate api level somewhere
- opcode = Opcodes.getDefault().getOpcodeByName(instructionNode.getText());
- if (opcode == null) {
- if (instructionNode.getText().equals(".packed-switch")) {
- return Opcode.PACKED_SWITCH_PAYLOAD;
- }
- if (instructionNode.getText().equals(".sparse-switch")) {
- return Opcode.SPARSE_SWITCH_PAYLOAD;
- }
- if (instructionNode.getText().equals(".array-data")) {
- return Opcode.ARRAY_PAYLOAD;
- }
- assert false;
- }
- }
- return opcode;
- }
-
- public int getOffset() {
- // TODO: don't calculate this recursively. ugh!
- if (offset == NO_OFFSET) {
- SmaliInstruction previousInstruction = findPrevSiblingByClass(SmaliInstruction.class);
- if (previousInstruction == null) {
- offset = 0;
- } else {
- offset = previousInstruction.getOffset() + previousInstruction.getInstructionSize();
- }
- }
- return offset;
- }
-
- public int getRegister(int registerIndex) {
- Preconditions.checkArgument(registerIndex >= 0);
-
- List registers = findChildrenByType(SmaliElementTypes.REGISTER_REFERENCE);
- if (registerIndex >= registers.size()) {
- return -1;
- }
-
- SmaliRegisterReference registerReference = (SmaliRegisterReference)registers.get(registerIndex);
- return registerReference.getRegisterNumber();
- }
-
- @Nullable
- public SmaliLabelReference getTarget() {
- return findChildByClass(SmaliLabelReference.class);
- }
-
- public int getRegisterCount() {
- return findChildrenByType(SmaliElementTypes.REGISTER_REFERENCE).size();
- }
-
- @Nullable
- public SmaliLiteral getLiteral() {
- return findChildByClass(SmaliLiteral.class);
- }
-
- @Nullable
- public SmaliTypeElement getTypeReference() {
- return findChildByClass(SmaliTypeElement.class);
- }
-
- @Nullable
- public SmaliFieldReference getFieldReference() {
- return findChildByClass(SmaliFieldReference.class);
- }
-
- @Nullable
- public SmaliMethodReference getMethodReference() {
- return findChildByClass(SmaliMethodReference.class);
- }
-
- @Nullable
- public SmaliLiteral getPackedSwitchStartKey() {
- return findChildByClass(SmaliLiteral.class);
- }
-
- @NotNull
- public List getPackedSwitchElements() {
- return Arrays.asList(findChildrenByClass(SmaliPackedSwitchElement.class));
- }
-
- @NotNull
- public List getSparseSwitchElements() {
- return Arrays.asList(findChildrenByClass(SmaliSparseSwitchElement.class));
- }
-
- @Nullable
- public SmaliLiteral getArrayDataWidth() {
- return findChildByClass(SmaliLiteral.class);
- }
-
- @NotNull
- public List getArrayDataElements() {
- return Arrays.asList(findChildrenByClass(SmaliArrayDataElement.class));
- }
-
- public int getInstructionSize() {
- Opcode opcode = getOpcode();
- if (!opcode.format.isPayloadFormat) {
- return opcode.format.size;
- } else if (opcode.format == Format.ArrayPayload) {
- int elementWidth = (int)getArrayDataWidth().getIntegralValue();
- int elementCount = getArrayDataElements().size();
-
- return 8 + (elementWidth * elementCount + 1);
- } else if (opcode.format == Format.PackedSwitchPayload) {
- return 8 + getPackedSwitchElements().size() * 4;
- } else if (opcode.format == Format.SparseSwitchPayload) {
- return 2 + getSparseSwitchElements().size() * 4;
- }
- assert false;
- throw new RuntimeException();
- }
-
- private AnalyzedInstruction analyzedInstruction = null;
-
- @Nullable
- private AnalyzedInstruction getAnalyzedInstructionFromMethod() {
- SmaliMethod method = getParentMethod();
-
- MethodAnalyzer analyzer = method.getMethodAnalyzer();
- if (analyzer == null) {
- return null;
- }
-
- int thisOffset = this.getOffset() / 2;
- int codeOffset = 0;
-
- for (AnalyzedInstruction instruction: analyzer.getAnalyzedInstructions()) {
- if (codeOffset == thisOffset) {
- return instruction;
- }
- assert codeOffset < thisOffset;
-
- codeOffset += instruction.getOriginalInstruction().getCodeUnits();
- }
- assert false;
- return null;
- }
-
- @Nullable
- public AnalyzedInstruction getAnalyzedInstruction() {
- if (analyzedInstruction == null) {
- analyzedInstruction = getAnalyzedInstructionFromMethod();
- }
- return analyzedInstruction;
- }
-
- @Override public void clearCaches() {
- super.clearCaches();
- analyzedInstruction = null;
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLabel.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLabel.java
deleted file mode 100644
index b07220dd..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLabel.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliLabel extends SmaliCompositeElement {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliLabel();
- }
- };
-
- public SmaliLabel() {
- super(SmaliElementTypes.LABEL);
- }
-
- @Override public String getName() {
- return getText().substring(1);
- }
-
- @Nullable
- public SmaliInstruction getInstruction() {
- return findNextSiblingByClass(SmaliInstruction.class);
- }
-
- @Nullable
- private SmaliInstruction getPreviousInstruction() {
- return findPrevSiblingByClass(SmaliInstruction.class);
- }
-
- public int getOffset() {
- SmaliInstruction instruction = getInstruction();
- if (instruction == null) {
- instruction = getPreviousInstruction();
- if (instruction == null) {
- return 0;
- }
- // TODO: handle variable size instructions
- return instruction.getOffset() + instruction.getOpcode().format.size;
- }
- return instruction.getOffset();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLabelReference.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLabelReference.java
deleted file mode 100644
index 940f4296..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLabelReference.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiReference;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliLabelReference extends SmaliCompositeElement implements PsiReference {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliLabelReference();
- }
- };
-
- public SmaliLabelReference() {
- super(SmaliElementTypes.LABEL_REFERENCE);
- }
-
- @Override public String getName() {
- return getText().substring(1);
- }
-
- @Override public PsiReference getReference() {
- return this;
- }
-
- @Override public PsiElement getElement() {
- return this;
- }
-
- @Override public TextRange getRangeInElement() {
- return new TextRange(0, getTextLength());
- }
-
- @Nullable @Override public SmaliLabel resolve() {
- SmaliMethod method = findAncestorByClass(SmaliMethod.class);
- if (method == null) {
- return null;
- }
- return method.getLabel(getText());
- }
-
- @NotNull @Override public String getCanonicalText() {
- return getText();
- }
-
- @Override public boolean isReferenceTo(PsiElement element) {
- return resolve() == element;
- }
-
- @NotNull @Override public Object[] getVariants() {
- return ArrayUtil.EMPTY_OBJECT_ARRAY;
- }
-
- @Override public boolean isSoft() {
- return false;
- }
-
- @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
- //TODO: implement this
- throw new IncorrectOperationException();
- }
-
- @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
- //TODO: implement this
- throw new IncorrectOperationException();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLineDebugStatement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLineDebugStatement.java
deleted file mode 100644
index 7ea3227b..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLineDebugStatement.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliLineDebugStatement extends SmaliCompositeElement {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliLineDebugStatement();
- }
- };
-
- public SmaliLineDebugStatement() {
- super(SmaliElementTypes.LINE_DEBUG_STATEMENT);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLiteral.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLiteral.java
deleted file mode 100644
index 0a9f5382..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLiteral.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.lang.ASTNode;
-import com.intellij.psi.PsiAnnotationMemberValue;
-import com.intellij.psi.tree.IElementType;
-import org.jf.smali.LiteralTools;
-import org.jf.smalidea.SmaliTokens;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliLiteral extends SmaliCompositeElement implements PsiAnnotationMemberValue {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliLiteral();
- }
- };
-
- public SmaliLiteral() {
- super(SmaliElementTypes.LITERAL);
- }
-
- public long getIntegralValue() {
- ASTNode literalNode = getNode().getFirstChildNode();
- IElementType literalType = literalNode.getElementType();
-
- if (literalType == SmaliTokens.LONG_LITERAL) {
- return LiteralTools.parseLong(literalNode.getText());
- } else if (literalType == SmaliTokens.NEGATIVE_INTEGER_LITERAL ||
- literalType == SmaliTokens.POSITIVE_INTEGER_LITERAL) {
- return LiteralTools.parseInt(literalNode.getText());
- } else if (literalType == SmaliTokens.SHORT_LITERAL) {
- return LiteralTools.parseShort(literalNode.getText());
- } else if (literalType == SmaliTokens.CHAR_LITERAL) {
- // TODO: implement this
- return -1;
- } else if (literalType == SmaliTokens.BYTE_LITERAL) {
- return LiteralTools.parseByte(literalNode.getText());
- } else if (literalType == SmaliTokens.BOOL_LITERAL) {
- return Boolean.parseBoolean(literalNode.getText())?1:0;
- } else {
- throw new RuntimeException("Not an integral literal");
- }
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLocalDebugStatement.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLocalDebugStatement.java
deleted file mode 100644
index 02d1748c..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLocalDebugStatement.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliLocalDebugStatement extends SmaliCompositeElement {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliLocalDebugStatement();
- }
- };
-
- public SmaliLocalDebugStatement() {
- super(SmaliElementTypes.LOCAL_DEBUG_STATEMENT);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLocalName.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLocalName.java
deleted file mode 100644
index 6ade23a4..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliLocalName.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.psi.PsiIdentifier;
-import com.intellij.psi.tree.IElementType;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-
-public class SmaliLocalName extends SmaliCompositeElement implements PsiIdentifier {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliLocalName();
- }
- };
-
- public SmaliLocalName() {
- super(SmaliElementTypes.LOCAL_NAME);
- }
-
- @Override public IElementType getTokenType() {
- return getNode().getElementType();
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliMemberName.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliMemberName.java
deleted file mode 100644
index f3377366..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliMemberName.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.intellij.psi.PsiIdentifier;
-import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
-import com.intellij.psi.tree.IElementType;
-import org.jetbrains.annotations.NotNull;
-import org.jf.smalidea.psi.SmaliCompositeElementFactory;
-import org.jf.smalidea.psi.SmaliElementTypes;
-import org.jf.smalidea.psi.leaf.SmaliSimpleName;
-
-public class SmaliMemberName extends SmaliCompositeElement implements PsiIdentifier {
- public static final SmaliCompositeElementFactory FACTORY = new SmaliCompositeElementFactory() {
- @Override public SmaliCompositeElement createElement() {
- return new SmaliMemberName();
- }
- };
-
- public SmaliMemberName() {
- super(SmaliElementTypes.MEMBER_NAME);
- }
-
- @Override public IElementType getTokenType() {
- return getElementType();
- }
-
- @Override
- public String getName() {
- return this.getText();
- }
-
- public void setName(@NotNull String newElementName) {
- removeAllChildren();
- SmaliSimpleName newNameElement = new SmaliSimpleName(newElementName);
- CodeEditUtil.setNodeGenerated(newNameElement, true);
-
- addChild(newNameElement);
- }
-}
diff --git a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliMethod.java b/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliMethod.java
deleted file mode 100644
index 8ba618b3..00000000
--- a/smalidea/src/main/java/org/jf/smalidea/psi/impl/SmaliMethod.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Copyright 2014, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.jf.smalidea.psi.impl;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.Maps;
-import com.intellij.debugger.SourcePosition;
-import com.intellij.lang.ASTNode;
-import com.intellij.openapi.editor.Document;
-import com.intellij.psi.*;
-import com.intellij.psi.PsiModifier.ModifierConstant;
-import com.intellij.psi.impl.PsiImplUtil;
-import com.intellij.psi.impl.PsiSuperMethodImplUtil;
-import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.psi.util.MethodSignature;
-import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jf.dexlib2.analysis.AnalysisException;
-import org.jf.dexlib2.analysis.ClassPath;
-import org.jf.dexlib2.analysis.MethodAnalyzer;
-import org.jf.smalidea.dexlib.SmalideaMethod;
-import org.jf.smalidea.dexlib.analysis.SmalideaClassProvider;
-import org.jf.smalidea.psi.SmaliElementTypes;
-import org.jf.smalidea.psi.iface.SmaliModifierListOwner;
-import org.jf.smalidea.psi.stub.SmaliMethodStub;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-public class SmaliMethod extends SmaliStubBasedPsiElement
- implements PsiMethod, SmaliModifierListOwner, PsiAnnotationMethod {
- public SmaliMethod(@NotNull SmaliMethodStub stub) {
- super(stub, SmaliElementTypes.METHOD);
- }
-
- public SmaliMethod(@NotNull ASTNode node) {
- super(node);
- }
-
- @NotNull @Override public String getName() {
- SmaliMethodStub stub = getStub();
- String name = null;
- if (stub != null) {
- name = stub.getName();
- } else {
- SmaliMemberName nameIdentifier = getNameIdentifier();
- if (nameIdentifier != null) {
- name = nameIdentifier.getText();
- }
- }
- if (name == null || name.isEmpty()) {
- name = "";
- }
- return name;
- }
-
- @Override public boolean hasTypeParameters() {
- // TODO: (generics) implement this
- return false;
- }
-
- @NotNull
- public SmaliMethodPrototype getMethodPrototype() {
- return getRequiredStubOrPsiChild(SmaliElementTypes.METHOD_PROTOTYPE);
- }
-
- @Nullable @Override public PsiType getReturnType() {
- if (isConstructor()) return null;
- return getMethodPrototype().getReturnType();
- }
-
- @Nullable @Override public PsiTypeElement getReturnTypeElement() {
- if (isConstructor()) return null;
- return getMethodPrototype().getReturnTypeElement();
- }
-
- @NotNull @Override public SmaliMethodParamList getParameterList() {
- return getMethodPrototype().getParameterList();
- }
-
- @NotNull @Override public SmaliThrowsList getThrowsList() {
- return getRequiredStubOrPsiChild(SmaliElementTypes.THROWS_LIST);
- }
-
- @Nullable @Override public PsiCodeBlock getBody() {
- // not applicable
- return null;
- }
-
- @NotNull public List getInstructions() {
- return findChildrenByType(SmaliElementTypes.INSTRUCTION);
- }
-
- @NotNull public List getCatchStatements() {
- return Arrays.asList(findChildrenByClass(SmaliCatchStatement.class));
- }
-
- @Nullable public SourcePosition getSourcePositionForCodeOffset(int offset) {
- for (SmaliInstruction instruction: getInstructions()) {
- if (instruction.getOffset() >= offset) {
- return SourcePosition.createFromElement(instruction);
- }
- }
- return null;
- }
-
- public int getOffsetForLine(int line) {
- PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject());
- final Document document = documentManager.getDocument(getContainingFile());
- if (document == null) {
- return -1;
- }
-
- for (final SmaliInstruction instruction: getInstructions()) {
- int curLine = document.getLineNumber(instruction.getTextOffset());
- if (curLine >= line) {
- return instruction.getOffset();
- }
- }
- return -1;
- }
-
- public int getRegisterCount() {
- SmaliRegistersStatement registersStatement = findChildByClass(SmaliRegistersStatement.class);
- if (registersStatement == null) {
- return 0;
- }
- return registersStatement.getRegisterCount();
- }
-
- public int getParameterRegisterCount() {
- int parameterRegisterCount = getMethodPrototype().getParameterList().getParameterRegisterCount();
- if (!isStatic()) {
- parameterRegisterCount++;
- }
- return parameterRegisterCount;
- }
-
- @NotNull public SmaliParameterStatement[] getParameterStatements() {
- return findChildrenByClass(SmaliParameterStatement.class);
- }
-
- @Override public boolean isConstructor() {
- // TODO: should this return true for the class initializer?
- return hasModifierProperty("constructor") && !hasModifierProperty("static");
- }
-
- public boolean isStatic() {
- return hasModifierProperty("static");
- }
-
- @Override public boolean isVarArgs() {
- return hasModifierProperty("varargs");
- }
-
- @NotNull @Override public MethodSignature getSignature(@NotNull PsiSubstitutor substitutor) {
- return MethodSignatureBackedByPsiMethod.create(this, substitutor);
- }
-
- @Nullable @Override public SmaliMemberName getNameIdentifier() {
- return findChildByClass(SmaliMemberName.class);
- }
-
- @NotNull @Override public PsiMethod[] findSuperMethods() {
- return PsiSuperMethodImplUtil.findSuperMethods(this);
- }
-
- @NotNull @Override public PsiMethod[] findSuperMethods(boolean checkAccess) {
- return PsiSuperMethodImplUtil.findSuperMethods(this, checkAccess);
- }
-
- @NotNull @Override public PsiMethod[] findSuperMethods(PsiClass parentClass) {
- return PsiSuperMethodImplUtil.findSuperMethods(this, parentClass);
- }
-
- @NotNull @Override
- public List findSuperMethodSignaturesIncludingStatic(boolean checkAccess) {
- return PsiSuperMethodImplUtil.findSuperMethodSignaturesIncludingStatic(this, checkAccess);
- }
-
- @Nullable @Override public PsiMethod findDeepestSuperMethod() {
- return PsiSuperMethodImplUtil.findDeepestSuperMethod(this);
- }
-
- @NotNull @Override public PsiMethod[] findDeepestSuperMethods() {
- return PsiSuperMethodImplUtil.findDeepestSuperMethods(this);
- }
-
- @NotNull @Override public SmaliModifierList getModifierList() {
- return getRequiredStubOrPsiChild(SmaliElementTypes.MODIFIER_LIST);
- }
-
- @Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
- SmaliMemberName smaliMemberName = getNameIdentifier();
- if (smaliMemberName == null) {
- throw new IncorrectOperationException();
- }
- smaliMemberName.setName(name);
- return this;
- }
-
- @NotNull @Override public HierarchicalMethodSignature getHierarchicalMethodSignature() {
- return PsiSuperMethodImplUtil.getHierarchicalMethodSignature(this);
- }
-
- @Nullable @Override public PsiDocComment getDocComment() {
- // not applicable
- return null;
- }
-
- @Override public boolean isDeprecated() {
- return PsiImplUtil.isDeprecatedByAnnotation(this);
- }
-
- @Nullable @Override public PsiTypeParameterList getTypeParameterList() {
- // TODO: (generics) implement this
- return null;
- }
-
- @NotNull @Override public PsiTypeParameter[] getTypeParameters() {
- // TODO: (generics) implement this
- return new PsiTypeParameter[0];
- }
-
- @Nullable @Override public SmaliClass getContainingClass() {
- PsiElement parent = getParentByStub();
- if (parent instanceof SmaliClass) {
- return (SmaliClass) parent;
- }
- return null;
- }
-
- @Override public boolean hasModifierProperty(@ModifierConstant @NonNls @NotNull String name) {
- return getModifierList().hasModifierProperty(name);
- }
-
- @NotNull @Override public SmaliAnnotation[] getAnnotations() {
- return getStubOrPsiChildren(SmaliElementTypes.ANNOTATION, new SmaliAnnotation[0]);
- }
-
- @NotNull @Override public SmaliAnnotation[] getApplicableAnnotations() {
- return getAnnotations();
- }
-
- @Nullable @Override public SmaliAnnotation findAnnotation(@NotNull @NonNls String qualifiedName) {
- for (SmaliAnnotation annotation: getAnnotations()) {
- if (qualifiedName.equals(annotation.getQualifiedName())) {
- return annotation;
- }
- }
- return null;
- }
-
- @NotNull @Override public SmaliAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) {
- // TODO: implement this
- return null;
- }
-
- private final Supplier