aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode/LineNumberAttribute.java
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-04-23 17:08:37 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-04-23 17:08:37 +0000
commitcdeddfd6fc34a06734f9fa525cf5c7437a6c8fb6 (patch)
tree0471a4d9b985b11969ecd6f521f660e3d468f1d1 /src/main/javassist/bytecode/LineNumberAttribute.java
parentfb431982111b03608b888953f7ed8ba7e98f421c (diff)
downloadjavassist-cdeddfd6fc34a06734f9fa525cf5c7437a6c8fb6.tar.gz
javassist-cdeddfd6fc34a06734f9fa525cf5c7437a6c8fb6.zip
Changed the copyright notices and removed tab characters.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@9 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/bytecode/LineNumberAttribute.java')
-rw-r--r--src/main/javassist/bytecode/LineNumberAttribute.java99
1 files changed, 44 insertions, 55 deletions
diff --git a/src/main/javassist/bytecode/LineNumberAttribute.java b/src/main/javassist/bytecode/LineNumberAttribute.java
index 35f1a020..eb597f84 100644
--- a/src/main/javassist/bytecode/LineNumberAttribute.java
+++ b/src/main/javassist/bytecode/LineNumberAttribute.java
@@ -1,28 +1,17 @@
/*
- * This file is part of the Javassist toolkit.
+ * Javassist, a Java-bytecode translator toolkit.
+ * Copyright (C) 1999-2003 Shigeru Chiba. All Rights Reserved.
*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * either http://www.mozilla.org/MPL/.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Javassist.
- *
- * The Initial Developer of the Original Code is Shigeru Chiba. Portions
- * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba.
- * All Rights Reserved.
- *
- * Contributor(s):
- *
- * The development of this software is supported in part by the PRESTO
- * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*/
-
package javassist.bytecode;
import java.io.DataInputStream;
@@ -39,13 +28,13 @@ public class LineNumberAttribute extends AttributeInfo {
public static final String tag = "LineNumberTable";
LineNumberAttribute(ConstPool cp, int n, DataInputStream in)
- throws IOException
+ throws IOException
{
- super(cp, n, in);
+ super(cp, n, in);
}
private LineNumberAttribute(ConstPool cp, byte[] i) {
- super(cp, tag, i);
+ super(cp, tag, i);
}
/**
@@ -53,7 +42,7 @@ public class LineNumberAttribute extends AttributeInfo {
* This represents the number of entries in the table.
*/
public int tableLength() {
- return ByteArray.readU16bit(info, 0);
+ return ByteArray.readU16bit(info, 0);
}
/**
@@ -61,10 +50,10 @@ public class LineNumberAttribute extends AttributeInfo {
* This represents the index into the code array at which the code
* for a new line in the original source file begins.
*
- * @param i the i-th entry.
+ * @param i the i-th entry.
*/
public int startPc(int i) {
- return ByteArray.readU16bit(info, i * 4 + 2);
+ return ByteArray.readU16bit(info, i * 4 + 2);
}
/**
@@ -72,60 +61,60 @@ public class LineNumberAttribute extends AttributeInfo {
* This represents the corresponding line number in the original
* source file.
*
- * @param i the i-th entry.
+ * @param i the i-th entry.
*/
public int lineNumber(int i) {
- return ByteArray.readU16bit(info, i * 4 + 4);
+ return ByteArray.readU16bit(info, i * 4 + 4);
}
/**
* Returns the line number corresponding to the specified bytecode.
*
- * @param pc the index into the code array.
+ * @param pc the index into the code array.
*/
public int toLineNumber(int pc) {
- int n = tableLength();
- int i = 0;
- for (; i < n; ++i)
- if (pc < startPc(i))
- if (i == 0)
- return lineNumber(0);
- else
- break;
+ int n = tableLength();
+ int i = 0;
+ for (; i < n; ++i)
+ if (pc < startPc(i))
+ if (i == 0)
+ return lineNumber(0);
+ else
+ break;
- return lineNumber(i - 1);
+ return lineNumber(i - 1);
}
/**
* Returns the index into the code array at which the code for
* the specified line begins.
*
- * @param line the line number.
- * @return -1 if the specified line is not found.
+ * @param line the line number.
+ * @return -1 if the specified line is not found.
*/
public int toStartPc(int line) {
- int n = tableLength();
- for (int i = 0; i < n; ++i)
- if (line == lineNumber(i))
- return startPc(i);
+ int n = tableLength();
+ for (int i = 0; i < n; ++i)
+ if (line == lineNumber(i))
+ return startPc(i);
- return -1;
+ return -1;
}
/**
* Makes a copy.
*
- * @param newCp the constant pool table used by the new copy.
- * @param classnames should be null.
+ * @param newCp the constant pool table used by the new copy.
+ * @param classnames should be null.
*/
public AttributeInfo copy(ConstPool newCp, Map classnames) {
- byte[] src = info;
- int num = src.length;
- byte[] dest = new byte[num];
- for (int i = 0; i < num; ++i)
- dest[i] = src[i];
+ byte[] src = info;
+ int num = src.length;
+ byte[] dest = new byte[num];
+ for (int i = 0; i < num; ++i)
+ dest[i] = src[i];
- LineNumberAttribute attr = new LineNumberAttribute(newCp, dest);
- return attr;
+ LineNumberAttribute attr = new LineNumberAttribute(newCp, dest);
+ return attr;
}
}