首页 \ 问答 \ 类文件常量池(javap)中的方法签名和描述符(Method signatures and descriptors in class file constant pool (javap))

类文件常量池(javap)中的方法签名和描述符(Method signatures and descriptors in class file constant pool (javap))

我试图找出类文件中常量池部分下面的以下两个条目:

int foo(int x) {
    return x;
}

#11 = Utf8               foo
#12 = Utf8               (I)I        // 1   
#13 = Utf8               x
#14 = Utf8               I           // 2

条目(1) - >(I)I表示函数的开始和条目(2) - > I表示函数的结束。

这个编译器是特定的还是可能因编译器而异?

Lambda函数也有类似的问题。

interface I { int foo(int x); }
class X {
I x = (int x1) -> 0;
}

 #15 = Utf8            lambda$new$0
 #16 = Utf8            (I)I
 #17 = Utf8            x1
 #18 = Utf8            I

抱歉在JLS文档上找不到任何内容。

谢谢


I am trying to figure out the following two entries under the constant pool section in the class file:

int foo(int x) {
    return x;
}

#11 = Utf8               foo
#12 = Utf8               (I)I        // 1   
#13 = Utf8               x
#14 = Utf8               I           // 2

Does the entry (1) -> (I)I denotes start of the function and the entry (2) -> I denotes end of function.

Is this compiler specific or could vary from one compiler to another?

Similar question for Lambda functions as well.

interface I { int foo(int x); }
class X {
I x = (int x1) -> 0;
}

 #15 = Utf8            lambda$new$0
 #16 = Utf8            (I)I
 #17 = Utf8            x1
 #18 = Utf8            I

Sorry Could not find anything on JLS docs.

Thanks


原文:https://stackoverflow.com/questions/22990957
更新时间:2023-11-07 10:11

最满意答案

我担心思考狮身人面像是不可能的 - 至少,不是那么简单。 你可以做的是使用你想要搜索的对象,获取它们的ID,并在过滤器中使用它:

possible_children = @technique.possible_children(current_user)
Technique.search params[:search],
  :with => {:sphinx_internal_id => possible_children.collect(&:id)}

Sphinx有自己的id,但是来自数据库的主键被Thinking Sphinx存储为属性sphinx_internal_id


I'm afraid this isn't possible with Thinking Sphinx - at least, not that simply. What you could do is use the objects you want to search across, grab their ids, and use that in a filter:

possible_children = @technique.possible_children(current_user)
Technique.search params[:search],
  :with => {:sphinx_internal_id => possible_children.collect(&:id)}

Sphinx has its own id, but the primary key from the database is stored as the attribute sphinx_internal_id by Thinking Sphinx.

相关问答

更多
  • 您已经明确表示该值不能作为projects表中的列使用,而是在相关模型上? 如果是这样,那么您可以通过关联来引用它: has user.is_eligible, :as => :is_user_eligible 但是,如果它不是列,但可以在SQL查询的上下文中确定,那么您可以使用SQL片段作为属性定义(我知道我的例子是相当人为的,但应该给你一些想法): has "(users.foo = 'bar' || users.baz = 'qux')", :as => :is_user_eligible, ...
  • 事实证明,这个问题与Thinking Sphinx如何处理Single Table Inheritance有关。 TS仅返回具有与父类的子类对应的type记录。 如果type为NULL ,则文档不包含在搜索结果中。 我们在accounts表中有很多type=NULL 。 修复数据后,搜索现在按预期工作。 感谢#sphinxsearch中的roman3x指向我。 It turns out the issue had to do with how Thinking Sphinx handles Single T ...
  • 问题是由于https://github.com/pat/thinking-sphinx/issues/148 (在rspec测试用例中默认禁用delta索引) 我必须将以下标志设置为true才能运行测试用例: ThinkingSphinx.deltas_enabled = true ThinkingSphinx.updates_enabled = true Issue was due to https://github.com/pat/thinking-sphinx/issues/148 (delta ...
  • 在将数据发送到搜索之前,您可以在用户数据末尾附加星号吗? can you append an asterisk at the end of user data before sending it to search?
  • 我不确定是否有一种优雅的方式来做到这一点,我很害怕。 我能想到的唯一选择是在你的索引定义中这样: (2008..Date.today.year).each do |year| has "SUM(CASE WHEN YEAR(posts.created_at) = #{year} THEN rating ELSE 0 END", as: "total_rating_for_#{year}".to_sym, type: :float end I'm not sure if there's an e ...
  • 我不知道这是否会有所帮助。但是对于开放式移动,您可以编译任何源代码并将其安装到任何前缀。例如$ OPENSHIFT_RUNTIME_DIR。 我认为最好的方法就是创建一个DIY(自己动手)应用程序并编译源代码中的所有内容,或者创建一个Ruby应用程序并安装所需的宝石,根据需要修改环境。 本文可能会为您提供有关在开放式平台上从源安装应用程序的想法。 https://openshift.redhat.com/community/blogs/enabling-python-27-on-a-paas-with-th ...
  • 问题与权限和Capistrano发布目录结构有关。 该服务由root拥有,从较旧版本运行,并且不会停止使用用户级别的rake ts:stop,它要求我以root身份运行它,然后从当前版本目录启动该服务。 此时,数据正在正确显示。 The problem had to do with permissions and the Capistrano release directory structure. The service was owned by root, was running from an old ...
  • 我担心思考狮身人面像是不可能的 - 至少,不是那么简单。 你可以做的是使用你想要搜索的对象,获取它们的ID,并在过滤器中使用它: possible_children = @technique.possible_children(current_user) Technique.search params[:search], :with => {:sphinx_internal_id => possible_children.collect(&:id)} Sphinx有自己的id,但是来自数据库的主键被T ...
  • 思维Sphinx没有内置任何东西来为多边形搜索提供一个整洁的界面,但它当然可以使用该功能。 您需要生成您想要的SphinxQL SELECT子句,相应地对其进行过滤,和/或您可以使用AttributesPane访问自定义AttributesPane 。 希望以下代码清楚: search = Model.search("foo", :select => "*, CONTAINS(GEOPOLY2D(...), ...) AS inside", :with => {:inside => true} ...
  • 最简单的方法是为两个模型的索引添加一个属性: has "1", :as => :sort_order, :type => :integer 每个模型中字符串中的数字应该不同。 然后你的:order参数变为: :order => 'sort_order ASC, @relevance DESC' The easiest way is to add an attribute to both models' indices: has "1", :as => :sort_order, :type => :int ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。